id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3,600 | NetEase/pomelo | lib/connectors/hybrid/tcpsocket.js | function(socket, opts) {
if(!(this instanceof Socket)) {
return new Socket(socket, opts);
}
if(!socket || !opts) {
throw new Error('invalid socket or opts');
}
if(!opts.headSize || typeof opts.headHandler !== 'function') {
throw new Error('invalid opts.headSize or opts.headHandler');
}
// s... | javascript | function(socket, opts) {
if(!(this instanceof Socket)) {
return new Socket(socket, opts);
}
if(!socket || !opts) {
throw new Error('invalid socket or opts');
}
if(!opts.headSize || typeof opts.headHandler !== 'function') {
throw new Error('invalid opts.headSize or opts.headHandler');
}
// s... | [
"function",
"(",
"socket",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Socket",
")",
")",
"{",
"return",
"new",
"Socket",
"(",
"socket",
",",
"opts",
")",
";",
"}",
"if",
"(",
"!",
"socket",
"||",
"!",
"opts",
")",
"{",
"... | closed
Tcp socket wrapper with package compositing.
Collect the package from socket and emit a completed package with 'data' event.
Uniform with ws.WebSocket interfaces.
@param {Object} socket origin socket from node.js net module
@param {Object} opts options parameter.
opts.headSize size of package head
opts.headH... | [
"closed",
"Tcp",
"socket",
"wrapper",
"with",
"package",
"compositing",
".",
"Collect",
"the",
"package",
"from",
"socket",
"and",
"emit",
"a",
"completed",
"package",
"with",
"data",
"event",
".",
"Uniform",
"with",
"ws",
".",
"WebSocket",
"interfaces",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/hybrid/tcpsocket.js#L24-L61 | |
3,601 | NetEase/pomelo | lib/connectors/hybrid/tcpsocket.js | function(socket, data, offset) {
var hlen = socket.headSize - socket.headOffset;
var dlen = data.length - offset;
var len = Math.min(hlen, dlen);
var dend = offset + len;
data.copy(socket.headBuffer, socket.headOffset, offset, dend);
socket.headOffset += len;
if(socket.headOffset === socket.headSize) {
... | javascript | function(socket, data, offset) {
var hlen = socket.headSize - socket.headOffset;
var dlen = data.length - offset;
var len = Math.min(hlen, dlen);
var dend = offset + len;
data.copy(socket.headBuffer, socket.headOffset, offset, dend);
socket.headOffset += len;
if(socket.headOffset === socket.headSize) {
... | [
"function",
"(",
"socket",
",",
"data",
",",
"offset",
")",
"{",
"var",
"hlen",
"=",
"socket",
".",
"headSize",
"-",
"socket",
".",
"headOffset",
";",
"var",
"dlen",
"=",
"data",
".",
"length",
"-",
"offset",
";",
"var",
"len",
"=",
"Math",
".",
"m... | Read head segment from data to socket.headBuffer.
@param {Object} socket Socket instance
@param {Object} data Buffer instance
@param {Number} offset offset read star from data
@return {Number} new offset of data after read | [
"Read",
"head",
"segment",
"from",
"data",
"to",
"socket",
".",
"headBuffer",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/hybrid/tcpsocket.js#L129-L160 | |
3,602 | NetEase/pomelo | lib/connectors/hybrid/tcpsocket.js | function(socket, data, offset) {
var blen = socket.packageSize - socket.packageOffset;
var dlen = data.length - offset;
var len = Math.min(blen, dlen);
var dend = offset + len;
data.copy(socket.packageBuffer, socket.packageOffset, offset, dend);
socket.packageOffset += len;
if(socket.packageOffset === ... | javascript | function(socket, data, offset) {
var blen = socket.packageSize - socket.packageOffset;
var dlen = data.length - offset;
var len = Math.min(blen, dlen);
var dend = offset + len;
data.copy(socket.packageBuffer, socket.packageOffset, offset, dend);
socket.packageOffset += len;
if(socket.packageOffset === ... | [
"function",
"(",
"socket",
",",
"data",
",",
"offset",
")",
"{",
"var",
"blen",
"=",
"socket",
".",
"packageSize",
"-",
"socket",
".",
"packageOffset",
";",
"var",
"dlen",
"=",
"data",
".",
"length",
"-",
"offset",
";",
"var",
"len",
"=",
"Math",
"."... | Read body segment from data buffer to socket.packageBuffer;
@param {Object} socket Socket instance
@param {Object} data Buffer instance
@param {Number} offset offset read star from data
@return {Number} new offset of data after read | [
"Read",
"body",
"segment",
"from",
"data",
"buffer",
"to",
"socket",
".",
"packageBuffer",
";"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/hybrid/tcpsocket.js#L170-L188 | |
3,603 | NetEase/pomelo | lib/server/server.js | function(isGlobal, server, msg, session, cb) {
var fm;
if(isGlobal) {
fm = server.globalFilterService;
} else {
fm = server.filterService;
}
if(fm) {
fm.beforeFilter(msg, session, cb);
} else {
utils.invokeCallback(cb);
}
} | javascript | function(isGlobal, server, msg, session, cb) {
var fm;
if(isGlobal) {
fm = server.globalFilterService;
} else {
fm = server.filterService;
}
if(fm) {
fm.beforeFilter(msg, session, cb);
} else {
utils.invokeCallback(cb);
}
} | [
"function",
"(",
"isGlobal",
",",
"server",
",",
"msg",
",",
"session",
",",
"cb",
")",
"{",
"var",
"fm",
";",
"if",
"(",
"isGlobal",
")",
"{",
"fm",
"=",
"server",
".",
"globalFilterService",
";",
"}",
"else",
"{",
"fm",
"=",
"server",
".",
"filte... | Fire before filter chain if any | [
"Fire",
"before",
"filter",
"chain",
"if",
"any"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/server/server.js#L234-L246 | |
3,604 | NetEase/pomelo | lib/server/server.js | function(isGlobal, server, err, msg, session, resp, opts, cb) {
if(isGlobal) {
cb(err, resp, opts);
// after filter should not interfere response
afterFilter(isGlobal, server, err, msg, session, resp, opts, cb);
} else {
afterFilter(isGlobal, server, err, msg, session, resp, opts, cb);
}
} | javascript | function(isGlobal, server, err, msg, session, resp, opts, cb) {
if(isGlobal) {
cb(err, resp, opts);
// after filter should not interfere response
afterFilter(isGlobal, server, err, msg, session, resp, opts, cb);
} else {
afterFilter(isGlobal, server, err, msg, session, resp, opts, cb);
}
} | [
"function",
"(",
"isGlobal",
",",
"server",
",",
"err",
",",
"msg",
",",
"session",
",",
"resp",
",",
"opts",
",",
"cb",
")",
"{",
"if",
"(",
"isGlobal",
")",
"{",
"cb",
"(",
"err",
",",
"resp",
",",
"opts",
")",
";",
"// after filter should not inte... | Send response to client and fire after filter chain if any. | [
"Send",
"response",
"to",
"client",
"and",
"fire",
"after",
"filter",
"chain",
"if",
"any",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/server/server.js#L297-L305 | |
3,605 | NetEase/pomelo | lib/server/server.js | function(cron, crons, server) {
if(!containCron(cron.id, crons)) {
server.crons.push(cron);
} else {
logger.warn('cron is duplicated: %j', cron);
}
} | javascript | function(cron, crons, server) {
if(!containCron(cron.id, crons)) {
server.crons.push(cron);
} else {
logger.warn('cron is duplicated: %j', cron);
}
} | [
"function",
"(",
"cron",
",",
"crons",
",",
"server",
")",
"{",
"if",
"(",
"!",
"containCron",
"(",
"cron",
".",
"id",
",",
"crons",
")",
")",
"{",
"server",
".",
"crons",
".",
"push",
"(",
"cron",
")",
";",
"}",
"else",
"{",
"logger",
".",
"wa... | If cron is not in crons then put it in the array. | [
"If",
"cron",
"is",
"not",
"in",
"crons",
"then",
"put",
"it",
"in",
"the",
"array",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/server/server.js#L434-L440 | |
3,606 | NetEase/pomelo | lib/server/server.js | function(id, crons) {
for(var i=0, l=crons.length; i<l; i++) {
if(id === crons[i].id) {
return true;
}
}
return false;
} | javascript | function(id, crons) {
for(var i=0, l=crons.length; i<l; i++) {
if(id === crons[i].id) {
return true;
}
}
return false;
} | [
"function",
"(",
"id",
",",
"crons",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"crons",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"id",
"===",
"crons",
"[",
"i",
"]",
".",
"id",
")",
"{",
"... | Check if cron is in crons. | [
"Check",
"if",
"cron",
"is",
"in",
"crons",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/server/server.js#L445-L452 | |
3,607 | NetEase/pomelo | lib/connectors/hybrid/wsprocessor.js | function() {
EventEmitter.call(this);
this.httpServer = new HttpServer();
var self = this;
this.wsServer = new WebSocketServer({server: this.httpServer});
this.wsServer.on('connection', function(socket) {
// emit socket to outside
self.emit('connection', socket);
});
this.state = ST_STARTED;
} | javascript | function() {
EventEmitter.call(this);
this.httpServer = new HttpServer();
var self = this;
this.wsServer = new WebSocketServer({server: this.httpServer});
this.wsServer.on('connection', function(socket) {
// emit socket to outside
self.emit('connection', socket);
});
this.state = ST_STARTED;
} | [
"function",
"(",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"httpServer",
"=",
"new",
"HttpServer",
"(",
")",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"wsServer",
"=",
"new",
"WebSocketServer",
"(",
"{",
"ser... | websocket protocol processor | [
"websocket",
"protocol",
"processor"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/hybrid/wsprocessor.js#L12-L25 | |
3,608 | NetEase/pomelo | lib/util/appUtil.js | function(app, args) {
app.set(Constants.RESERVED.ENV, args.env || process.env.NODE_ENV || Constants.RESERVED.ENV_DEV, true);
} | javascript | function(app, args) {
app.set(Constants.RESERVED.ENV, args.env || process.env.NODE_ENV || Constants.RESERVED.ENV_DEV, true);
} | [
"function",
"(",
"app",
",",
"args",
")",
"{",
"app",
".",
"set",
"(",
"Constants",
".",
"RESERVED",
".",
"ENV",
",",
"args",
".",
"env",
"||",
"process",
".",
"env",
".",
"NODE_ENV",
"||",
"Constants",
".",
"RESERVED",
".",
"ENV_DEV",
",",
"true",
... | Setup enviroment. | [
"Setup",
"enviroment",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/util/appUtil.js#L193-L195 | |
3,609 | NetEase/pomelo | lib/util/appUtil.js | function(app) {
if (process.env.POMELO_LOGGER !== 'off') {
var env = app.get(Constants.RESERVED.ENV);
var originPath = path.join(app.getBase(), Constants.FILEPATH.LOG);
var presentPath = path.join(app.getBase(), Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.LOG));
if(fs.existsSy... | javascript | function(app) {
if (process.env.POMELO_LOGGER !== 'off') {
var env = app.get(Constants.RESERVED.ENV);
var originPath = path.join(app.getBase(), Constants.FILEPATH.LOG);
var presentPath = path.join(app.getBase(), Constants.FILEPATH.CONFIG_DIR, env, path.basename(Constants.FILEPATH.LOG));
if(fs.existsSy... | [
"function",
"(",
"app",
")",
"{",
"if",
"(",
"process",
".",
"env",
".",
"POMELO_LOGGER",
"!==",
"'off'",
")",
"{",
"var",
"env",
"=",
"app",
".",
"get",
"(",
"Constants",
".",
"RESERVED",
".",
"ENV",
")",
";",
"var",
"originPath",
"=",
"path",
"."... | Configure custom logger. | [
"Configure",
"custom",
"logger",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/util/appUtil.js#L200-L213 | |
3,610 | NetEase/pomelo | lib/util/appUtil.js | function(app) {
var filePath = path.join(app.getBase(), Constants.FILEPATH.SERVER_DIR, app.serverType, Constants.FILEPATH.LIFECYCLE);
if(!fs.existsSync(filePath)) {
return;
}
var lifecycle = require(filePath);
for(var key in lifecycle) {
if(typeof lifecycle[key] === 'function') {
app.lifecycleCb... | javascript | function(app) {
var filePath = path.join(app.getBase(), Constants.FILEPATH.SERVER_DIR, app.serverType, Constants.FILEPATH.LIFECYCLE);
if(!fs.existsSync(filePath)) {
return;
}
var lifecycle = require(filePath);
for(var key in lifecycle) {
if(typeof lifecycle[key] === 'function') {
app.lifecycleCb... | [
"function",
"(",
"app",
")",
"{",
"var",
"filePath",
"=",
"path",
".",
"join",
"(",
"app",
".",
"getBase",
"(",
")",
",",
"Constants",
".",
"FILEPATH",
".",
"SERVER_DIR",
",",
"app",
".",
"serverType",
",",
"Constants",
".",
"FILEPATH",
".",
"LIFECYCLE... | Load lifecycle file. | [
"Load",
"lifecycle",
"file",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/util/appUtil.js#L249-L262 | |
3,611 | NetEase/pomelo | lib/components/remote.js | function(app) {
var paths = [];
var role;
// master server should not come here
if(app.isFrontend()) {
role = 'frontend';
} else {
role = 'backend';
}
var sysPath = pathUtil.getSysRemotePath(role), serverType = app.getServerType();
if(fs.existsSync(sysPath)) {
paths.push(pathUtil.remotePat... | javascript | function(app) {
var paths = [];
var role;
// master server should not come here
if(app.isFrontend()) {
role = 'frontend';
} else {
role = 'backend';
}
var sysPath = pathUtil.getSysRemotePath(role), serverType = app.getServerType();
if(fs.existsSync(sysPath)) {
paths.push(pathUtil.remotePat... | [
"function",
"(",
"app",
")",
"{",
"var",
"paths",
"=",
"[",
"]",
";",
"var",
"role",
";",
"// master server should not come here",
"if",
"(",
"app",
".",
"isFrontend",
"(",
")",
")",
"{",
"role",
"=",
"'frontend'",
";",
"}",
"else",
"{",
"role",
"=",
... | Get remote paths from application
@param {Object} app current application context
@return {Array} paths | [
"Get",
"remote",
"paths",
"from",
"application"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/remote.js#L77-L98 | |
3,612 | NetEase/pomelo | lib/components/remote.js | function(app, opts) {
opts.paths = getRemotePaths(app);
opts.context = app;
if(!!opts.rpcServer) {
return opts.rpcServer.create(opts);
} else {
return RemoteServer.create(opts);
}
} | javascript | function(app, opts) {
opts.paths = getRemotePaths(app);
opts.context = app;
if(!!opts.rpcServer) {
return opts.rpcServer.create(opts);
} else {
return RemoteServer.create(opts);
}
} | [
"function",
"(",
"app",
",",
"opts",
")",
"{",
"opts",
".",
"paths",
"=",
"getRemotePaths",
"(",
"app",
")",
";",
"opts",
".",
"context",
"=",
"app",
";",
"if",
"(",
"!",
"!",
"opts",
".",
"rpcServer",
")",
"{",
"return",
"opts",
".",
"rpcServer",
... | Generate remote server instance
@param {Object} app current application context
@param {Object} opts contructor parameters for rpc Server
@return {Object} remote server instance | [
"Generate",
"remote",
"server",
"instance"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/remote.js#L107-L115 | |
3,613 | NetEase/pomelo | lib/components/connector.js | function(app, opts) {
opts = opts || {};
this.app = app;
this.connector = getConnector(app, opts);
this.encode = opts.encode;
this.decode = opts.decode;
this.useCrypto = opts.useCrypto;
this.useHostFilter = opts.useHostFilter;
this.useAsyncCoder = opts.useAsyncCoder;
this.blacklistFun = opts.blacklist... | javascript | function(app, opts) {
opts = opts || {};
this.app = app;
this.connector = getConnector(app, opts);
this.encode = opts.encode;
this.decode = opts.decode;
this.useCrypto = opts.useCrypto;
this.useHostFilter = opts.useHostFilter;
this.useAsyncCoder = opts.useAsyncCoder;
this.blacklistFun = opts.blacklist... | [
"function",
"(",
"app",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"this",
".",
"app",
"=",
"app",
";",
"this",
".",
"connector",
"=",
"getConnector",
"(",
"app",
",",
"opts",
")",
";",
"this",
".",
"encode",
"=",
"opts",
... | Connector component. Receive client requests and attach session with socket.
@param {Object} app current application context
@param {Object} opts attach parameters
opts.connector {Object} provides low level network and protocol details implementation between server and clients. | [
"Connector",
"component",
".",
"Receive",
"client",
"requests",
"and",
"attach",
"session",
"with",
"socket",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/connector.js#L19-L44 | |
3,614 | NetEase/pomelo | lib/components/connector.js | function(self, socket) {
var app = self.app,
sid = socket.id;
var session = self.session.get(sid);
if (session) {
return session;
}
session = self.session.create(sid, app.getServerId(), socket);
logger.debug('[%s] getSession session is created with session id: %s', app.getServerId(), sid);
// bi... | javascript | function(self, socket) {
var app = self.app,
sid = socket.id;
var session = self.session.get(sid);
if (session) {
return session;
}
session = self.session.create(sid, app.getServerId(), socket);
logger.debug('[%s] getSession session is created with session id: %s', app.getServerId(), sid);
// bi... | [
"function",
"(",
"self",
",",
"socket",
")",
"{",
"var",
"app",
"=",
"self",
".",
"app",
",",
"sid",
"=",
"socket",
".",
"id",
";",
"var",
"session",
"=",
"self",
".",
"session",
".",
"get",
"(",
"sid",
")",
";",
"if",
"(",
"session",
")",
"{",... | get session for current connection | [
"get",
"session",
"for",
"current",
"connection"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/connector.js#L331-L367 | |
3,615 | NetEase/pomelo | lib/components/connector.js | function(route) {
if (!route) {
return null;
}
var idx = route.indexOf('.');
if (idx < 0) {
return null;
}
return route.substring(0, idx);
} | javascript | function(route) {
if (!route) {
return null;
}
var idx = route.indexOf('.');
if (idx < 0) {
return null;
}
return route.substring(0, idx);
} | [
"function",
"(",
"route",
")",
"{",
"if",
"(",
"!",
"route",
")",
"{",
"return",
"null",
";",
"}",
"var",
"idx",
"=",
"route",
".",
"indexOf",
"(",
"'.'",
")",
";",
"if",
"(",
"idx",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"return",
"... | Get server type form request message. | [
"Get",
"server",
"type",
"form",
"request",
"message",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/connector.js#L406-L415 | |
3,616 | NetEase/pomelo | lib/components/proxy.js | function(app, opts) {
this.app = app;
this.opts = opts;
this.client = genRpcClient(this.app, opts);
this.app.event.on(events.ADD_SERVERS, this.addServers.bind(this));
this.app.event.on(events.REMOVE_SERVERS, this.removeServers.bind(this));
this.app.event.on(events.REPLACE_SERVERS, this.replaceServers.bind(t... | javascript | function(app, opts) {
this.app = app;
this.opts = opts;
this.client = genRpcClient(this.app, opts);
this.app.event.on(events.ADD_SERVERS, this.addServers.bind(this));
this.app.event.on(events.REMOVE_SERVERS, this.removeServers.bind(this));
this.app.event.on(events.REPLACE_SERVERS, this.replaceServers.bind(t... | [
"function",
"(",
"app",
",",
"opts",
")",
"{",
"this",
".",
"app",
"=",
"app",
";",
"this",
".",
"opts",
"=",
"opts",
";",
"this",
".",
"client",
"=",
"genRpcClient",
"(",
"this",
".",
"app",
",",
"opts",
")",
";",
"this",
".",
"app",
".",
"eve... | Proxy component class
@param {Object} app current application context
@param {Object} opts construct parameters | [
"Proxy",
"component",
"class"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/proxy.js#L45-L52 | |
3,617 | NetEase/pomelo | lib/components/proxy.js | function(app, opts) {
opts.context = app;
opts.routeContext = app;
if(!!opts.rpcClient) {
return opts.rpcClient.create(opts);
} else {
return Client.create(opts);
}
} | javascript | function(app, opts) {
opts.context = app;
opts.routeContext = app;
if(!!opts.rpcClient) {
return opts.rpcClient.create(opts);
} else {
return Client.create(opts);
}
} | [
"function",
"(",
"app",
",",
"opts",
")",
"{",
"opts",
".",
"context",
"=",
"app",
";",
"opts",
".",
"routeContext",
"=",
"app",
";",
"if",
"(",
"!",
"!",
"opts",
".",
"rpcClient",
")",
"{",
"return",
"opts",
".",
"rpcClient",
".",
"create",
"(",
... | Generate rpc client
@param {Object} app current application context
@param {Object} opts contructor parameters for rpc client
@return {Object} rpc client | [
"Generate",
"rpc",
"client"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/components/proxy.js#L160-L168 | |
3,618 | NetEase/pomelo | lib/connectors/siosocket.js | function(id, socket) {
EventEmitter.call(this);
this.id = id;
this.socket = socket;
this.remoteAddress = {
ip: socket.handshake.address.address,
port: socket.handshake.address.port
};
var self = this;
socket.on('disconnect', this.emit.bind(this, 'disconnect'));
socket.on('error', this.emit.bi... | javascript | function(id, socket) {
EventEmitter.call(this);
this.id = id;
this.socket = socket;
this.remoteAddress = {
ip: socket.handshake.address.address,
port: socket.handshake.address.port
};
var self = this;
socket.on('disconnect', this.emit.bind(this, 'disconnect'));
socket.on('error', this.emit.bi... | [
"function",
"(",
"id",
",",
"socket",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"id",
"=",
"id",
";",
"this",
".",
"socket",
"=",
"socket",
";",
"this",
".",
"remoteAddress",
"=",
"{",
"ip",
":",
"socket",
".",
"h... | Socket class that wraps socket.io socket to provide unified interface for up level. | [
"Socket",
"class",
"that",
"wraps",
"socket",
".",
"io",
"socket",
"to",
"provide",
"unified",
"interface",
"for",
"up",
"level",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/siosocket.js#L10-L32 | |
3,619 | NetEase/pomelo | lib/connectors/siosocket.js | function(msgs){
var res = '[', msg;
for(var i=0, l=msgs.length; i<l; i++) {
if(i > 0) {
res += ',';
}
msg = msgs[i];
if(typeof msg === 'string') {
res += msg;
} else {
res += JSON.stringify(msg);
}
}
res += ']';
return res;
} | javascript | function(msgs){
var res = '[', msg;
for(var i=0, l=msgs.length; i<l; i++) {
if(i > 0) {
res += ',';
}
msg = msgs[i];
if(typeof msg === 'string') {
res += msg;
} else {
res += JSON.stringify(msg);
}
}
res += ']';
return res;
} | [
"function",
"(",
"msgs",
")",
"{",
"var",
"res",
"=",
"'['",
",",
"msg",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"msgs",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"res... | Encode batch msg to client | [
"Encode",
"batch",
"msg",
"to",
"client"
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/siosocket.js#L64-L79 | |
3,620 | NetEase/pomelo | lib/util/countDownLatch.js | function(count, opts, cb) {
this.count = count;
this.cb = cb;
var self = this;
if (opts.timeout) {
this.timerId = setTimeout(function() {
self.cb(true);
}, opts.timeout);
}
} | javascript | function(count, opts, cb) {
this.count = count;
this.cb = cb;
var self = this;
if (opts.timeout) {
this.timerId = setTimeout(function() {
self.cb(true);
}, opts.timeout);
}
} | [
"function",
"(",
"count",
",",
"opts",
",",
"cb",
")",
"{",
"this",
".",
"count",
"=",
"count",
";",
"this",
".",
"cb",
"=",
"cb",
";",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"opts",
".",
"timeout",
")",
"{",
"this",
".",
"timerId",
"=",
... | Count down to zero or timeout and invoke cb finally. | [
"Count",
"down",
"to",
"zero",
"or",
"timeout",
"and",
"invoke",
"cb",
"finally",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/util/countDownLatch.js#L6-L15 | |
3,621 | GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | cached | function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
} | javascript | function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
} | [
"function",
"cached",
"(",
"fn",
")",
"{",
"var",
"cache",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"return",
"(",
"function",
"cachedFn",
"(",
"str",
")",
"{",
"var",
"hit",
"=",
"cache",
"[",
"str",
"]",
";",
"return",
"hit",
"||",
... | Create a cached version of a pure function. | [
"Create",
"a",
"cached",
"version",
"of",
"a",
"pure",
"function",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L104-L110 |
3,622 | GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | toObject | function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
} | javascript | function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
} | [
"function",
"toObject",
"(",
"arr",
")",
"{",
"var",
"res",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"arr",
"[",
"i",
"]",
")",
"{",
"extend",
"(",
"re... | Merge an Array of Objects into a single Object. | [
"Merge",
"an",
"Array",
"of",
"Objects",
"into",
"a",
"single",
"Object",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L159-L167 |
3,623 | GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | genStaticKeys | function genStaticKeys (modules) {
return modules.reduce(function (keys, m) {
return keys.concat(m.staticKeys || [])
}, []).join(',')
} | javascript | function genStaticKeys (modules) {
return modules.reduce(function (keys, m) {
return keys.concat(m.staticKeys || [])
}, []).join(',')
} | [
"function",
"genStaticKeys",
"(",
"modules",
")",
"{",
"return",
"modules",
".",
"reduce",
"(",
"function",
"(",
"keys",
",",
"m",
")",
"{",
"return",
"keys",
".",
"concat",
"(",
"m",
".",
"staticKeys",
"||",
"[",
"]",
")",
"}",
",",
"[",
"]",
")",... | Generate a static keys string from compiler modules. | [
"Generate",
"a",
"static",
"keys",
"string",
"from",
"compiler",
"modules",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L187-L191 |
3,624 | GeekyAnts/vue-native-core | dist/vue.runtime.common.js | looseEqual | function looseEqual (a, b) {
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
return JSON.stringify(a) === JSON.stringify(b)
} catch (e) {
// possible circular reference
return a === b
}
} else if (!isObjectA && !isObjectB) {
return ... | javascript | function looseEqual (a, b) {
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
return JSON.stringify(a) === JSON.stringify(b)
} catch (e) {
// possible circular reference
return a === b
}
} else if (!isObjectA && !isObjectB) {
return ... | [
"function",
"looseEqual",
"(",
"a",
",",
"b",
")",
"{",
"var",
"isObjectA",
"=",
"isObject",
"(",
"a",
")",
";",
"var",
"isObjectB",
"=",
"isObject",
"(",
"b",
")",
";",
"if",
"(",
"isObjectA",
"&&",
"isObjectB",
")",
"{",
"try",
"{",
"return",
"JS... | Generate a static keys string from compiler modules.
Check if two values are loosely equal - that is,
if they are plain objects, do they have the same shape? | [
"Generate",
"a",
"static",
"keys",
"string",
"from",
"compiler",
"modules",
".",
"Check",
"if",
"two",
"values",
"are",
"loosely",
"equal",
"-",
"that",
"is",
"if",
"they",
"are",
"plain",
"objects",
"do",
"they",
"have",
"the",
"same",
"shape?"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L221-L236 |
3,625 | GeekyAnts/vue-native-core | dist/vue.runtime.common.js | once | function once (fn) {
var called = false;
return function () {
if (!called) {
called = true;
fn.apply(this, arguments);
}
}
} | javascript | function once (fn) {
var called = false;
return function () {
if (!called) {
called = true;
fn.apply(this, arguments);
}
}
} | [
"function",
"once",
"(",
"fn",
")",
"{",
"var",
"called",
"=",
"false",
";",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"!",
"called",
")",
"{",
"called",
"=",
"true",
";",
"fn",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"}",
... | Ensure a function is called only once. | [
"Ensure",
"a",
"function",
"is",
"called",
"only",
"once",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L248-L256 |
3,626 | GeekyAnts/vue-native-core | dist/vue.runtime.common.js | simpleNormalizeChildren | function simpleNormalizeChildren (children) {
for (var i = 0; i < children.length; i++) {
if (Array.isArray(children[i])) {
return Array.prototype.concat.apply([], children)
}
}
return children
} | javascript | function simpleNormalizeChildren (children) {
for (var i = 0; i < children.length; i++) {
if (Array.isArray(children[i])) {
return Array.prototype.concat.apply([], children)
}
}
return children
} | [
"function",
"simpleNormalizeChildren",
"(",
"children",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"children",
"[",
"i",
"]",
")",
")",
... | 1. When the children contains components - because a functional component may return an Array instead of a single root. In this case, just a simple normalization is needed - if any child is an Array, we flatten the whole thing with Array.prototype.concat. It is guaranteed to be only 1-level deep because functional comp... | [
"1",
".",
"When",
"the",
"children",
"contains",
"components",
"-",
"because",
"a",
"functional",
"component",
"may",
"return",
"an",
"Array",
"instead",
"of",
"a",
"single",
"root",
".",
"In",
"this",
"case",
"just",
"a",
"simple",
"normalization",
"is",
... | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/dist/vue.runtime.common.js#L1771-L1778 |
3,627 | GeekyAnts/vue-native-core | packages/vue-native-helper/build.js | _toString | function _toString(val) {
return val == null
? ''
: typeof val === 'object'
? JSON.stringify(val, null, 2)
: String(val)
} | javascript | function _toString(val) {
return val == null
? ''
: typeof val === 'object'
? JSON.stringify(val, null, 2)
: String(val)
} | [
"function",
"_toString",
"(",
"val",
")",
"{",
"return",
"val",
"==",
"null",
"?",
"''",
":",
"typeof",
"val",
"===",
"'object'",
"?",
"JSON",
".",
"stringify",
"(",
"val",
",",
"null",
",",
"2",
")",
":",
"String",
"(",
"val",
")",
"}"
] | Convert a value to a string that is actually rendered. | [
"Convert",
"a",
"value",
"to",
"a",
"string",
"that",
"is",
"actually",
"rendered",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-native-helper/build.js#L50-L56 |
3,628 | GeekyAnts/vue-native-core | src/platforms/weex/runtime/modules/transition.js | getEnterTargetState | function getEnterTargetState (el, stylesheet, startClass, endClass, activeClass, vm) {
const targetState = {}
const startState = stylesheet[startClass]
const endState = stylesheet[endClass]
const activeState = stylesheet[activeClass]
// 1. fallback to element's default styling
if (startState) {
for (con... | javascript | function getEnterTargetState (el, stylesheet, startClass, endClass, activeClass, vm) {
const targetState = {}
const startState = stylesheet[startClass]
const endState = stylesheet[endClass]
const activeState = stylesheet[activeClass]
// 1. fallback to element's default styling
if (startState) {
for (con... | [
"function",
"getEnterTargetState",
"(",
"el",
",",
"stylesheet",
",",
"startClass",
",",
"endClass",
",",
"activeClass",
",",
"vm",
")",
"{",
"const",
"targetState",
"=",
"{",
"}",
"const",
"startState",
"=",
"stylesheet",
"[",
"startClass",
"]",
"const",
"e... | determine the target animation style for an entering transition. | [
"determine",
"the",
"target",
"animation",
"style",
"for",
"an",
"entering",
"transition",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/src/platforms/weex/runtime/modules/transition.js#L227-L265 |
3,629 | GeekyAnts/vue-native-core | examples/svg/svg.js | function () {
var total = this.stats.length
return this.stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, total)
return point.x + ',' + point.y
}).join(' ')
} | javascript | function () {
var total = this.stats.length
return this.stats.map(function (stat, i) {
var point = valueToPoint(stat.value, i, total)
return point.x + ',' + point.y
}).join(' ')
} | [
"function",
"(",
")",
"{",
"var",
"total",
"=",
"this",
".",
"stats",
".",
"length",
"return",
"this",
".",
"stats",
".",
"map",
"(",
"function",
"(",
"stat",
",",
"i",
")",
"{",
"var",
"point",
"=",
"valueToPoint",
"(",
"stat",
".",
"value",
",",
... | a computed property for the polygon's points | [
"a",
"computed",
"property",
"for",
"the",
"polygon",
"s",
"points"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/examples/svg/svg.js#L17-L23 | |
3,630 | GeekyAnts/vue-native-core | examples/svg/svg.js | valueToPoint | function valueToPoint (value, index, total) {
var x = 0
var y = -value * 0.8
var angle = Math.PI * 2 / total * index
var cos = Math.cos(angle)
var sin = Math.sin(angle)
var tx = x * cos - y * sin + 100
var ty = x * sin + y * cos + 100
return {
x: tx,
y: ty
}
} | javascript | function valueToPoint (value, index, total) {
var x = 0
var y = -value * 0.8
var angle = Math.PI * 2 / total * index
var cos = Math.cos(angle)
var sin = Math.sin(angle)
var tx = x * cos - y * sin + 100
var ty = x * sin + y * cos + 100
return {
x: tx,
y: ty
}
} | [
"function",
"valueToPoint",
"(",
"value",
",",
"index",
",",
"total",
")",
"{",
"var",
"x",
"=",
"0",
"var",
"y",
"=",
"-",
"value",
"*",
"0.8",
"var",
"angle",
"=",
"Math",
".",
"PI",
"*",
"2",
"/",
"total",
"*",
"index",
"var",
"cos",
"=",
"M... | math helper... | [
"math",
"helper",
"..."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/examples/svg/svg.js#L48-L60 |
3,631 | GeekyAnts/vue-native-core | packages/weex-vue-framework/factory.js | assertType | function assertType (value, type) {
var valid;
var expectedType = getType(type);
if (expectedType === 'String') {
valid = typeof value === (expectedType = 'string');
} else if (expectedType === 'Number') {
valid = typeof value === (expectedType = 'number');
} else if (expectedType === 'Boolean') {
... | javascript | function assertType (value, type) {
var valid;
var expectedType = getType(type);
if (expectedType === 'String') {
valid = typeof value === (expectedType = 'string');
} else if (expectedType === 'Number') {
valid = typeof value === (expectedType = 'number');
} else if (expectedType === 'Boolean') {
... | [
"function",
"assertType",
"(",
"value",
",",
"type",
")",
"{",
"var",
"valid",
";",
"var",
"expectedType",
"=",
"getType",
"(",
"type",
")",
";",
"if",
"(",
"expectedType",
"===",
"'String'",
")",
"{",
"valid",
"=",
"typeof",
"value",
"===",
"(",
"expe... | Assert the type of a value | [
"Assert",
"the",
"type",
"of",
"a",
"value"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/factory.js#L1384-L1406 |
3,632 | GeekyAnts/vue-native-core | packages/weex-vue-framework/index.js | init | function init (cfg) {
renderer.Document = cfg.Document;
renderer.Element = cfg.Element;
renderer.Comment = cfg.Comment;
renderer.sendTasks = cfg.sendTasks;
} | javascript | function init (cfg) {
renderer.Document = cfg.Document;
renderer.Element = cfg.Element;
renderer.Comment = cfg.Comment;
renderer.sendTasks = cfg.sendTasks;
} | [
"function",
"init",
"(",
"cfg",
")",
"{",
"renderer",
".",
"Document",
"=",
"cfg",
".",
"Document",
";",
"renderer",
".",
"Element",
"=",
"cfg",
".",
"Element",
";",
"renderer",
".",
"Comment",
"=",
"cfg",
".",
"Comment",
";",
"renderer",
".",
"sendTas... | Prepare framework config, basically about the virtual-DOM and JS bridge.
@param {object} cfg | [
"Prepare",
"framework",
"config",
"basically",
"about",
"the",
"virtual",
"-",
"DOM",
"and",
"JS",
"bridge",
"."
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/index.js#L33-L38 |
3,633 | GeekyAnts/vue-native-core | packages/weex-vue-framework/index.js | genModuleGetter | function genModuleGetter (instanceId) {
var instance = instances[instanceId];
return function (name) {
var nativeModule = modules[name] || [];
var output = {};
var loop = function ( methodName ) {
output[methodName] = function () {
var args = [], len = arguments.length;
while ( len... | javascript | function genModuleGetter (instanceId) {
var instance = instances[instanceId];
return function (name) {
var nativeModule = modules[name] || [];
var output = {};
var loop = function ( methodName ) {
output[methodName] = function () {
var args = [], len = arguments.length;
while ( len... | [
"function",
"genModuleGetter",
"(",
"instanceId",
")",
"{",
"var",
"instance",
"=",
"instances",
"[",
"instanceId",
"]",
";",
"return",
"function",
"(",
"name",
")",
"{",
"var",
"nativeModule",
"=",
"modules",
"[",
"name",
"]",
"||",
"[",
"]",
";",
"var"... | Generate native module getter. Each native module has several
methods to call. And all the behaviors is instance-related. So
this getter will return a set of methods which additionally
send current instance id to native when called. Also the args
will be normalized into "safe" value. For example function arg
will be co... | [
"Generate",
"native",
"module",
"getter",
".",
"Each",
"native",
"module",
"has",
"several",
"methods",
"to",
"call",
".",
"And",
"all",
"the",
"behaviors",
"is",
"instance",
"-",
"related",
".",
"So",
"this",
"getter",
"will",
"return",
"a",
"set",
"of",
... | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/weex-vue-framework/index.js#L323-L343 |
3,634 | GeekyAnts/vue-native-core | src/platforms/weex/framework.js | normalize | function normalize (v, instance) {
const type = typof(v)
switch (type) {
case 'undefined':
case 'null':
return ''
case 'regexp':
return v.toString()
case 'date':
return v.toISOString()
case 'number':
case 'string':
case 'boolean':
case 'array':
case 'object':
... | javascript | function normalize (v, instance) {
const type = typof(v)
switch (type) {
case 'undefined':
case 'null':
return ''
case 'regexp':
return v.toString()
case 'date':
return v.toISOString()
case 'number':
case 'string':
case 'boolean':
case 'array':
case 'object':
... | [
"function",
"normalize",
"(",
"v",
",",
"instance",
")",
"{",
"const",
"type",
"=",
"typof",
"(",
"v",
")",
"switch",
"(",
"type",
")",
"{",
"case",
"'undefined'",
":",
"case",
"'null'",
":",
"return",
"''",
"case",
"'regexp'",
":",
"return",
"v",
".... | Convert all type of values into "safe" format to send to native.
1. A `function` will be converted into callback id.
2. An `Element` object will be converted into `ref`.
The `instance` param is used to generate callback id and store
function if necessary.
@param {any} v
@param {object} instance
@return {any} | [
"Convert",
"all",
"type",
"of",
"values",
"into",
"safe",
"format",
"to",
"send",
"to",
"native",
".",
"1",
".",
"A",
"function",
"will",
"be",
"converted",
"into",
"callback",
"id",
".",
"2",
".",
"An",
"Element",
"object",
"will",
"be",
"converted",
... | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/src/platforms/weex/framework.js#L380-L406 |
3,635 | muaz-khan/RTCMultiConnection | dev/getUserMedia.js | setStreamType | function setStreamType(constraints, stream) {
if (constraints.mandatory && constraints.mandatory.chromeMediaSource) {
stream.isScreen = true;
} else if (constraints.mozMediaSource || constraints.mediaSource) {
stream.isScreen = true;
} else if (constraints.video) {
stream.isVideo = t... | javascript | function setStreamType(constraints, stream) {
if (constraints.mandatory && constraints.mandatory.chromeMediaSource) {
stream.isScreen = true;
} else if (constraints.mozMediaSource || constraints.mediaSource) {
stream.isScreen = true;
} else if (constraints.video) {
stream.isVideo = t... | [
"function",
"setStreamType",
"(",
"constraints",
",",
"stream",
")",
"{",
"if",
"(",
"constraints",
".",
"mandatory",
"&&",
"constraints",
".",
"mandatory",
".",
"chromeMediaSource",
")",
"{",
"stream",
".",
"isScreen",
"=",
"true",
";",
"}",
"else",
"if",
... | getUserMediaHandler.js | [
"getUserMediaHandler",
".",
"js"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/getUserMedia.js#L3-L13 |
3,636 | muaz-khan/RTCMultiConnection | dev/XHRConnection.js | xhr | function xhr(url, callback, data) {
if (!window.XMLHttpRequest || !window.JSON) return;
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (callback && request.readyState == 4 && request.status == 200) {
// server MUST return JSON text
... | javascript | function xhr(url, callback, data) {
if (!window.XMLHttpRequest || !window.JSON) return;
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (callback && request.readyState == 4 && request.status == 200) {
// server MUST return JSON text
... | [
"function",
"xhr",
"(",
"url",
",",
"callback",
",",
"data",
")",
"{",
"if",
"(",
"!",
"window",
".",
"XMLHttpRequest",
"||",
"!",
"window",
".",
"JSON",
")",
"return",
";",
"var",
"request",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"request",
".... | a simple function to make XMLHttpRequests | [
"a",
"simple",
"function",
"to",
"make",
"XMLHttpRequests"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/XHRConnection.js#L16-L34 |
3,637 | muaz-khan/RTCMultiConnection | dev/TextSenderReceiver.js | TextReceiver | function TextReceiver(connection) {
var content = {};
function receive(data, userid, extra) {
// uuid is used to uniquely identify sending instance
var uuid = data.uuid;
if (!content[uuid]) {
content[uuid] = [];
}
content[uuid].push(data.message);
i... | javascript | function TextReceiver(connection) {
var content = {};
function receive(data, userid, extra) {
// uuid is used to uniquely identify sending instance
var uuid = data.uuid;
if (!content[uuid]) {
content[uuid] = [];
}
content[uuid].push(data.message);
i... | [
"function",
"TextReceiver",
"(",
"connection",
")",
"{",
"var",
"content",
"=",
"{",
"}",
";",
"function",
"receive",
"(",
"data",
",",
"userid",
",",
"extra",
")",
"{",
"// uuid is used to uniquely identify sending instance",
"var",
"uuid",
"=",
"data",
".",
... | TextReceiver.js & TextSender.js | [
"TextReceiver",
".",
"js",
"&",
"TextSender",
".",
"js"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/TextSenderReceiver.js#L3-L49 |
3,638 | muaz-khan/RTCMultiConnection | dev/MediaStreamRecorder.js | mergeProps | function mergeProps(mergein, mergeto) {
for (var t in mergeto) {
if (typeof mergeto[t] !== 'function') {
mergein[t] = mergeto[t];
}
}
return mergein;
} | javascript | function mergeProps(mergein, mergeto) {
for (var t in mergeto) {
if (typeof mergeto[t] !== 'function') {
mergein[t] = mergeto[t];
}
}
return mergein;
} | [
"function",
"mergeProps",
"(",
"mergein",
",",
"mergeto",
")",
"{",
"for",
"(",
"var",
"t",
"in",
"mergeto",
")",
"{",
"if",
"(",
"typeof",
"mergeto",
"[",
"t",
"]",
"!==",
"'function'",
")",
"{",
"mergein",
"[",
"t",
"]",
"=",
"mergeto",
"[",
"t",... | Merge all other data-types except "function" | [
"Merge",
"all",
"other",
"data",
"-",
"types",
"except",
"function"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L907-L914 |
3,639 | muaz-khan/RTCMultiConnection | dev/MediaStreamRecorder.js | WhammyVideo | function WhammyVideo(duration, quality) {
this.frames = [];
if (!duration) {
duration = 1;
}
this.duration = 1000 / duration;
this.quality = quality || 0.8;
} | javascript | function WhammyVideo(duration, quality) {
this.frames = [];
if (!duration) {
duration = 1;
}
this.duration = 1000 / duration;
this.quality = quality || 0.8;
} | [
"function",
"WhammyVideo",
"(",
"duration",
",",
"quality",
")",
"{",
"this",
".",
"frames",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"duration",
")",
"{",
"duration",
"=",
"1",
";",
"}",
"this",
".",
"duration",
"=",
"1000",
"/",
"duration",
";",
"this... | a more abstract-ish API | [
"a",
"more",
"abstract",
"-",
"ish",
"API"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L2228-L2235 |
3,640 | muaz-khan/RTCMultiConnection | dev/MediaStreamRecorder.js | checkFrames | function checkFrames(frames) {
if (!frames[0]) {
postMessage({
error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
});
return;
}
var width = frames[0].width,
hei... | javascript | function checkFrames(frames) {
if (!frames[0]) {
postMessage({
error: 'Something went wrong. Maybe WebP format is not supported in the current browser.'
});
return;
}
var width = frames[0].width,
hei... | [
"function",
"checkFrames",
"(",
"frames",
")",
"{",
"if",
"(",
"!",
"frames",
"[",
"0",
"]",
")",
"{",
"postMessage",
"(",
"{",
"error",
":",
"'Something went wrong. Maybe WebP format is not supported in the current browser.'",
"}",
")",
";",
"return",
";",
"}",
... | sums the lengths of all the frames and gets the duration | [
"sums",
"the",
"lengths",
"of",
"all",
"the",
"frames",
"and",
"gets",
"the",
"duration"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/MediaStreamRecorder.js#L2415-L2435 |
3,641 | muaz-khan/RTCMultiConnection | dev/ios-hacks.js | setCordovaAPIs | function setCordovaAPIs() {
// if (DetectRTC.osName !== 'iOS') return;
if (typeof cordova === 'undefined' || typeof cordova.plugins === 'undefined' || typeof cordova.plugins.iosrtc === 'undefined') return;
var iosrtc = cordova.plugins.iosrtc;
window.webkitRTCPeerConnection = iosrtc.RTCPeerConnection;
... | javascript | function setCordovaAPIs() {
// if (DetectRTC.osName !== 'iOS') return;
if (typeof cordova === 'undefined' || typeof cordova.plugins === 'undefined' || typeof cordova.plugins.iosrtc === 'undefined') return;
var iosrtc = cordova.plugins.iosrtc;
window.webkitRTCPeerConnection = iosrtc.RTCPeerConnection;
... | [
"function",
"setCordovaAPIs",
"(",
")",
"{",
"// if (DetectRTC.osName !== 'iOS') return;",
"if",
"(",
"typeof",
"cordova",
"===",
"'undefined'",
"||",
"typeof",
"cordova",
".",
"plugins",
"===",
"'undefined'",
"||",
"typeof",
"cordova",
".",
"plugins",
".",
"iosrtc"... | ios-hacks.js | [
"ios",
"-",
"hacks",
".",
"js"
] | 2032ce949bde30b43a3d2666e0f1e5afbf337f3d | https://github.com/muaz-khan/RTCMultiConnection/blob/2032ce949bde30b43a3d2666e0f1e5afbf337f3d/dev/ios-hacks.js#L3-L20 |
3,642 | getsentry/sentry-javascript | packages/raven-js/plugins/ember.js | emberPlugin | function emberPlugin(Raven, Ember) {
Ember = Ember || window.Ember;
// quit if Ember isn't on the page
if (!Ember) return;
var _oldOnError = Ember.onerror;
Ember.onerror = function EmberOnError(error) {
Raven.captureException(error);
if (typeof _oldOnError === 'function') {
_oldOnError.call(th... | javascript | function emberPlugin(Raven, Ember) {
Ember = Ember || window.Ember;
// quit if Ember isn't on the page
if (!Ember) return;
var _oldOnError = Ember.onerror;
Ember.onerror = function EmberOnError(error) {
Raven.captureException(error);
if (typeof _oldOnError === 'function') {
_oldOnError.call(th... | [
"function",
"emberPlugin",
"(",
"Raven",
",",
"Ember",
")",
"{",
"Ember",
"=",
"Ember",
"||",
"window",
".",
"Ember",
";",
"// quit if Ember isn't on the page",
"if",
"(",
"!",
"Ember",
")",
"return",
";",
"var",
"_oldOnError",
"=",
"Ember",
".",
"onerror",
... | Ember.js plugin
Patches event handler callbacks and ajax callbacks. | [
"Ember",
".",
"js",
"plugin"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/plugins/ember.js#L6-L28 |
3,643 | getsentry/sentry-javascript | packages/raven-js/Gruntfile.js | AddPluginBrowserifyTransformer | function AddPluginBrowserifyTransformer() {
var noop = function(chunk, _, cb) {
cb(null, chunk);
};
var append = function(cb) {
cb(null, "\nrequire('../src/singleton').addPlugin(module.exports);");
};
return function(file) {
return through(noop, /plugins/.test(file) ? append : unde... | javascript | function AddPluginBrowserifyTransformer() {
var noop = function(chunk, _, cb) {
cb(null, chunk);
};
var append = function(cb) {
cb(null, "\nrequire('../src/singleton').addPlugin(module.exports);");
};
return function(file) {
return through(noop, /plugins/.test(file) ? append : unde... | [
"function",
"AddPluginBrowserifyTransformer",
"(",
")",
"{",
"var",
"noop",
"=",
"function",
"(",
"chunk",
",",
"_",
",",
"cb",
")",
"{",
"cb",
"(",
"null",
",",
"chunk",
")",
";",
"}",
";",
"var",
"append",
"=",
"function",
"(",
"cb",
")",
"{",
"c... | custom browserify transformer to re-write plugins to self-register with Raven via addPlugin | [
"custom",
"browserify",
"transformer",
"to",
"re",
"-",
"write",
"plugins",
"to",
"self",
"-",
"register",
"with",
"Raven",
"via",
"addPlugin"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/Gruntfile.js#L26-L36 |
3,644 | getsentry/sentry-javascript | packages/raven-js/src/raven.js | Raven | function Raven() {
this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify);
// Raven can run in contexts where there's no document (react-native)
this._hasDocument = !isUndefined(_document);
this._hasNavigator = !isUndefined(_navigator);
this._lastCapturedException = null;
this._lastData = null;
th... | javascript | function Raven() {
this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify);
// Raven can run in contexts where there's no document (react-native)
this._hasDocument = !isUndefined(_document);
this._hasNavigator = !isUndefined(_navigator);
this._lastCapturedException = null;
this._lastData = null;
th... | [
"function",
"Raven",
"(",
")",
"{",
"this",
".",
"_hasJSON",
"=",
"!",
"!",
"(",
"typeof",
"JSON",
"===",
"'object'",
"&&",
"JSON",
".",
"stringify",
")",
";",
"// Raven can run in contexts where there's no document (react-native)",
"this",
".",
"_hasDocument",
"=... | First, check for JSON support If there is no JSON, we no-op the core features of Raven since JSON is required to encode the payload | [
"First",
"check",
"for",
"JSON",
"support",
"If",
"there",
"is",
"no",
"JSON",
"we",
"no",
"-",
"op",
"the",
"core",
"features",
"of",
"Raven",
"since",
"JSON",
"is",
"required",
"to",
"encode",
"the",
"payload"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/src/raven.js#L67-L128 |
3,645 | getsentry/sentry-javascript | packages/raven-js/src/raven.js | function() {
TraceKit.report.uninstall();
this._detachPromiseRejectionHandler();
this._unpatchFunctionToString();
this._restoreBuiltIns();
this._restoreConsole();
Error.stackTraceLimit = this._originalErrorStackTraceLimit;
this._isRavenInstalled = false;
return this;
} | javascript | function() {
TraceKit.report.uninstall();
this._detachPromiseRejectionHandler();
this._unpatchFunctionToString();
this._restoreBuiltIns();
this._restoreConsole();
Error.stackTraceLimit = this._originalErrorStackTraceLimit;
this._isRavenInstalled = false;
return this;
} | [
"function",
"(",
")",
"{",
"TraceKit",
".",
"report",
".",
"uninstall",
"(",
")",
";",
"this",
".",
"_detachPromiseRejectionHandler",
"(",
")",
";",
"this",
".",
"_unpatchFunctionToString",
"(",
")",
";",
"this",
".",
"_restoreBuiltIns",
"(",
")",
";",
"th... | Uninstalls the global error handler.
@return {Raven} | [
"Uninstalls",
"the",
"global",
"error",
"handler",
"."
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/src/raven.js#L406-L418 | |
3,646 | getsentry/sentry-javascript | packages/raven-js/src/raven.js | function(ex, options) {
options = objectMerge({trimHeadFrames: 0}, options ? options : {});
if (isErrorEvent(ex) && ex.error) {
// If it is an ErrorEvent with `error` property, extract it to get actual Error
ex = ex.error;
} else if (isDOMError(ex) || isDOMException(ex)) {
// If it is a D... | javascript | function(ex, options) {
options = objectMerge({trimHeadFrames: 0}, options ? options : {});
if (isErrorEvent(ex) && ex.error) {
// If it is an ErrorEvent with `error` property, extract it to get actual Error
ex = ex.error;
} else if (isDOMError(ex) || isDOMException(ex)) {
// If it is a D... | [
"function",
"(",
"ex",
",",
"options",
")",
"{",
"options",
"=",
"objectMerge",
"(",
"{",
"trimHeadFrames",
":",
"0",
"}",
",",
"options",
"?",
"options",
":",
"{",
"}",
")",
";",
"if",
"(",
"isErrorEvent",
"(",
"ex",
")",
"&&",
"ex",
".",
"error",... | Manually capture an exception and send it over to Sentry
@param {error} ex An exception to be logged
@param {object} options A specific set of options for this error [optional]
@return {Raven} | [
"Manually",
"capture",
"an",
"exception",
"and",
"send",
"it",
"over",
"to",
"Sentry"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/src/raven.js#L468-L534 | |
3,647 | getsentry/sentry-javascript | packages/raven-js/src/raven.js | function(current) {
var last = this._lastData;
if (
!last ||
current.message !== last.message || // defined for captureMessage
current.transaction !== last.transaction // defined for captureException/onerror
)
return false;
// Stacktrace interface (i.e. from captureMessage)
... | javascript | function(current) {
var last = this._lastData;
if (
!last ||
current.message !== last.message || // defined for captureMessage
current.transaction !== last.transaction // defined for captureException/onerror
)
return false;
// Stacktrace interface (i.e. from captureMessage)
... | [
"function",
"(",
"current",
")",
"{",
"var",
"last",
"=",
"this",
".",
"_lastData",
";",
"if",
"(",
"!",
"last",
"||",
"current",
".",
"message",
"!==",
"last",
".",
"message",
"||",
"// defined for captureMessage",
"current",
".",
"transaction",
"!==",
"l... | Returns true if the in-process data payload matches the signature
of the previously-sent data
NOTE: This has to be done at this level because TraceKit can generate
data from window.onerror WITHOUT an exception object (IE8, IE9,
other old browsers). This can take the form of an "exception"
data object with a single fra... | [
"Returns",
"true",
"if",
"the",
"in",
"-",
"process",
"data",
"payload",
"matches",
"the",
"signature",
"of",
"the",
"previously",
"-",
"sent",
"data"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/src/raven.js#L1908-L1930 | |
3,648 | getsentry/sentry-javascript | packages/browser/src/loader.js | function(content) {
// content.e = error
// content.p = promise rejection
// content.f = function call the Sentry
if (
(content.e ||
content.p ||
(content.f && content.f.indexOf('capture') > -1) ||
(content.f && content.f.indexOf('showReportDialog') > -1)) &&
lazy
... | javascript | function(content) {
// content.e = error
// content.p = promise rejection
// content.f = function call the Sentry
if (
(content.e ||
content.p ||
(content.f && content.f.indexOf('capture') > -1) ||
(content.f && content.f.indexOf('showReportDialog') > -1)) &&
lazy
... | [
"function",
"(",
"content",
")",
"{",
"// content.e = error",
"// content.p = promise rejection",
"// content.f = function call the Sentry",
"if",
"(",
"(",
"content",
".",
"e",
"||",
"content",
".",
"p",
"||",
"(",
"content",
".",
"f",
"&&",
"content",
".",
"f",
... | Create a namespace and attach function that will store captured exception Because functions are also objects, we can attach the queue itself straight to it and save some bytes | [
"Create",
"a",
"namespace",
"and",
"attach",
"function",
"that",
"will",
"store",
"captured",
"exception",
"Because",
"functions",
"are",
"also",
"objects",
"we",
"can",
"attach",
"the",
"queue",
"itself",
"straight",
"to",
"it",
"and",
"save",
"some",
"bytes"... | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/browser/src/loader.js#L29-L46 | |
3,649 | getsentry/sentry-javascript | packages/raven-js/scripts/generate-plugin-combinations.js | generate | function generate(plugins, dest) {
const pluginNames = plugins.map((plugin) => {
return path.basename(plugin, '.js');
});
const pluginCombinations = combine(pluginNames);
pluginCombinations.forEach((pluginCombination) => {
fs.writeFileSync(
path.resolve(dest, `${pluginCombination.join(',')}.js`)... | javascript | function generate(plugins, dest) {
const pluginNames = plugins.map((plugin) => {
return path.basename(plugin, '.js');
});
const pluginCombinations = combine(pluginNames);
pluginCombinations.forEach((pluginCombination) => {
fs.writeFileSync(
path.resolve(dest, `${pluginCombination.join(',')}.js`)... | [
"function",
"generate",
"(",
"plugins",
",",
"dest",
")",
"{",
"const",
"pluginNames",
"=",
"plugins",
".",
"map",
"(",
"(",
"plugin",
")",
"=>",
"{",
"return",
"path",
".",
"basename",
"(",
"plugin",
",",
"'.js'",
")",
";",
"}",
")",
";",
"const",
... | Generate all plugin combinations.
@param {array} plugins
@param {string} dest | [
"Generate",
"all",
"plugin",
"combinations",
"."
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/scripts/generate-plugin-combinations.js#L46-L59 |
3,650 | getsentry/sentry-javascript | packages/raven-node/lib/client.js | Client | function Client(dsn, options) {
if (dsn instanceof Client) return dsn;
var ravenInstance = new Raven();
return ravenInstance.config.apply(ravenInstance, arguments);
} | javascript | function Client(dsn, options) {
if (dsn instanceof Client) return dsn;
var ravenInstance = new Raven();
return ravenInstance.config.apply(ravenInstance, arguments);
} | [
"function",
"Client",
"(",
"dsn",
",",
"options",
")",
"{",
"if",
"(",
"dsn",
"instanceof",
"Client",
")",
"return",
"dsn",
";",
"var",
"ravenInstance",
"=",
"new",
"Raven",
"(",
")",
";",
"return",
"ravenInstance",
".",
"config",
".",
"apply",
"(",
"r... | Maintain old API compat, need to make sure arguments length is preserved | [
"Maintain",
"old",
"API",
"compat",
"need",
"to",
"make",
"sure",
"arguments",
"length",
"is",
"preserved"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-node/lib/client.js#L662-L666 |
3,651 | getsentry/sentry-javascript | packages/raven-js/scripts/build.js | build | async function build(inputOptions, outputOptions) {
const input = Object.assign(
{
plugins: [
commonjs(), // We can remove this plugin if there are no more CommonJS modules
resolve(), // We need this plugin only to build the test script
babel({
exclude: 'node_modules/**'
... | javascript | async function build(inputOptions, outputOptions) {
const input = Object.assign(
{
plugins: [
commonjs(), // We can remove this plugin if there are no more CommonJS modules
resolve(), // We need this plugin only to build the test script
babel({
exclude: 'node_modules/**'
... | [
"async",
"function",
"build",
"(",
"inputOptions",
",",
"outputOptions",
")",
"{",
"const",
"input",
"=",
"Object",
".",
"assign",
"(",
"{",
"plugins",
":",
"[",
"commonjs",
"(",
")",
",",
"// We can remove this plugin if there are no more CommonJS modules",
"resolv... | Only needed for test build
Build using rollup.js
@see https://rollupjs.org/#javascript-api
@param inputOptions
@param outputOptions
@returns Promise | [
"Only",
"needed",
"for",
"test",
"build",
"Build",
"using",
"rollup",
".",
"js"
] | a872223343fecf7364473b78bede937f1eb57bd0 | https://github.com/getsentry/sentry-javascript/blob/a872223343fecf7364473b78bede937f1eb57bd0/packages/raven-js/scripts/build.js#L15-L38 |
3,652 | Project-OSRM/osrm-backend | scripts/osrm-runner.js | ServerDetails | function ServerDetails(x) {
if (!(this instanceof ServerDetails)) return new ServerDetails(x);
const v = x.split(':');
this.hostname = (v[0].length > 0) ? v[0] : '';
this.port = (v.length > 1) ? Number(v[1]) : 80;
} | javascript | function ServerDetails(x) {
if (!(this instanceof ServerDetails)) return new ServerDetails(x);
const v = x.split(':');
this.hostname = (v[0].length > 0) ? v[0] : '';
this.port = (v.length > 1) ? Number(v[1]) : 80;
} | [
"function",
"ServerDetails",
"(",
"x",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"ServerDetails",
")",
")",
"return",
"new",
"ServerDetails",
"(",
"x",
")",
";",
"const",
"v",
"=",
"x",
".",
"split",
"(",
"':'",
")",
";",
"this",
".",
"h... | Command line arguments | [
"Command",
"line",
"arguments"
] | e86d93760f51304940d55d62c0d47f15094d6712 | https://github.com/Project-OSRM/osrm-backend/blob/e86d93760f51304940d55d62c0d47f15094d6712/scripts/osrm-runner.js#L86-L91 |
3,653 | wix/react-native-ui-lib | scripts/utils/propTypesHandler.js | propTypesDocsHandler | function propTypesDocsHandler(documentation, path) {
const propTypesPath = getMemberValuePath(path, 'propTypes');
const docComment = getDocblock(propTypesPath.parent);
const statementPattern = /@.*\:/;
const info = {};
if (docComment) {
const infoRaw = _.split(docComment, '\n');
_.forEach(infoRaw, (s... | javascript | function propTypesDocsHandler(documentation, path) {
const propTypesPath = getMemberValuePath(path, 'propTypes');
const docComment = getDocblock(propTypesPath.parent);
const statementPattern = /@.*\:/;
const info = {};
if (docComment) {
const infoRaw = _.split(docComment, '\n');
_.forEach(infoRaw, (s... | [
"function",
"propTypesDocsHandler",
"(",
"documentation",
",",
"path",
")",
"{",
"const",
"propTypesPath",
"=",
"getMemberValuePath",
"(",
"path",
",",
"'propTypes'",
")",
";",
"const",
"docComment",
"=",
"getDocblock",
"(",
"propTypesPath",
".",
"parent",
")",
... | Extract info on the component props | [
"Extract",
"info",
"on",
"the",
"component",
"props"
] | 439d36c7932bc3cfe574320e8f214a03f988c5ac | https://github.com/wix/react-native-ui-lib/blob/439d36c7932bc3cfe574320e8f214a03f988c5ac/scripts/utils/propTypesHandler.js#L10-L26 |
3,654 | wuchangming/spy-debugger | buildin_modules/weinre/web/client/inspector.js | flushQueue | function flushQueue()
{
var queued = WebInspector.log.queued;
if (!queued)
return;
for (var i = 0; i < queued.length; ++i)
logMessage(queued[i]);
delete WebInspector.log.queued;
} | javascript | function flushQueue()
{
var queued = WebInspector.log.queued;
if (!queued)
return;
for (var i = 0; i < queued.length; ++i)
logMessage(queued[i]);
delete WebInspector.log.queued;
} | [
"function",
"flushQueue",
"(",
")",
"{",
"var",
"queued",
"=",
"WebInspector",
".",
"log",
".",
"queued",
";",
"if",
"(",
"!",
"queued",
")",
"return",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"queued",
".",
"length",
";",
"++",
"i",... | flush the queue of pending messages | [
"flush",
"the",
"queue",
"of",
"pending",
"messages"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/inspector.js#L1213-L1223 |
3,655 | wuchangming/spy-debugger | buildin_modules/weinre/web/client/inspector.js | flushQueueIfAvailable | function flushQueueIfAvailable()
{
if (!isLogAvailable())
return;
clearInterval(WebInspector.log.interval);
delete WebInspector.log.interval;
flushQueue();
} | javascript | function flushQueueIfAvailable()
{
if (!isLogAvailable())
return;
clearInterval(WebInspector.log.interval);
delete WebInspector.log.interval;
flushQueue();
} | [
"function",
"flushQueueIfAvailable",
"(",
")",
"{",
"if",
"(",
"!",
"isLogAvailable",
"(",
")",
")",
"return",
";",
"clearInterval",
"(",
"WebInspector",
".",
"log",
".",
"interval",
")",
";",
"delete",
"WebInspector",
".",
"log",
".",
"interval",
";",
"fl... | flush the queue if it console is available - this function is run on an interval | [
"flush",
"the",
"queue",
"if",
"it",
"console",
"is",
"available",
"-",
"this",
"function",
"is",
"run",
"on",
"an",
"interval"
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/inspector.js#L1227-L1236 |
3,656 | wuchangming/spy-debugger | buildin_modules/weinre/web/client/UglifyJS/process.js | fixrefs | function fixrefs(scope, i) {
// do children first; order shouldn't matter
for (i = scope.children.length; --i >= 0;)
fixrefs(scope.children[i]);
for (i in scope.refs) if (HOP(scope.refs, i)) {
... | javascript | function fixrefs(scope, i) {
// do children first; order shouldn't matter
for (i = scope.children.length; --i >= 0;)
fixrefs(scope.children[i]);
for (i in scope.refs) if (HOP(scope.refs, i)) {
... | [
"function",
"fixrefs",
"(",
"scope",
",",
"i",
")",
"{",
"// do children first; order shouldn't matter",
"for",
"(",
"i",
"=",
"scope",
".",
"children",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"fixrefs",
"(",
"scope",
".",
"children",
"[",
"i... | for referenced names it might be useful to know their origin scope. current_scope here is the toplevel one. | [
"for",
"referenced",
"names",
"it",
"might",
"be",
"useful",
"to",
"know",
"their",
"origin",
"scope",
".",
"current_scope",
"here",
"is",
"the",
"toplevel",
"one",
"."
] | 55c1dda0dff0c44920673711656ddfd7ff03c307 | https://github.com/wuchangming/spy-debugger/blob/55c1dda0dff0c44920673711656ddfd7ff03c307/buildin_modules/weinre/web/client/UglifyJS/process.js#L439-L450 |
3,657 | ai/size-limit | index.js | getSize | async function getSize (files, opts) {
if (typeof files === 'string') files = [files]
if (!opts) opts = { }
if (opts.webpack === false) {
let sizes = await Promise.all(files.map(async file => {
let bytes = await readFile(file, 'utf8')
let result = { parsed: bytes.length }
if (opts.running !... | javascript | async function getSize (files, opts) {
if (typeof files === 'string') files = [files]
if (!opts) opts = { }
if (opts.webpack === false) {
let sizes = await Promise.all(files.map(async file => {
let bytes = await readFile(file, 'utf8')
let result = { parsed: bytes.length }
if (opts.running !... | [
"async",
"function",
"getSize",
"(",
"files",
",",
"opts",
")",
"{",
"if",
"(",
"typeof",
"files",
"===",
"'string'",
")",
"files",
"=",
"[",
"files",
"]",
"if",
"(",
"!",
"opts",
")",
"opts",
"=",
"{",
"}",
"if",
"(",
"opts",
".",
"webpack",
"==... | Return size of project files with all dependencies and after UglifyJS
and gzip.
@param {string|string[]} files Files to get size.
@param {object} [opts] Extra options.
@param {"server"|"static"|false} [opts.analyzer=false] Show package
content in browser.
@param {boolean} [opts.webpack=true] Pack files by webpack.
@pa... | [
"Return",
"size",
"of",
"project",
"files",
"with",
"all",
"dependencies",
"and",
"after",
"UglifyJS",
"and",
"gzip",
"."
] | 0795111fe22771a7e7b82ab95f8e2e43f08dc2cf | https://github.com/ai/size-limit/blob/0795111fe22771a7e7b82ab95f8e2e43f08dc2cf/index.js#L212-L266 |
3,658 | zeit/now-cli | src/commands/inspect.js | getEventMetadata | function getEventMetadata({ event, payload }) {
if (event === 'state') {
return chalk.bold(payload.value);
}
if (event === 'instance-start' || event === 'instance-stop') {
if (payload.dc != null) {
return chalk.green(`(${payload.dc})`);
}
}
return '';
} | javascript | function getEventMetadata({ event, payload }) {
if (event === 'state') {
return chalk.bold(payload.value);
}
if (event === 'instance-start' || event === 'instance-stop') {
if (payload.dc != null) {
return chalk.green(`(${payload.dc})`);
}
}
return '';
} | [
"function",
"getEventMetadata",
"(",
"{",
"event",
",",
"payload",
"}",
")",
"{",
"if",
"(",
"event",
"===",
"'state'",
")",
"{",
"return",
"chalk",
".",
"bold",
"(",
"payload",
".",
"value",
")",
";",
"}",
"if",
"(",
"event",
"===",
"'instance-start'"... | gets the metadata that should be printed next to each event | [
"gets",
"the",
"metadata",
"that",
"should",
"be",
"printed",
"next",
"to",
"each",
"event"
] | b53d907b745126113bc3e251ac2451088026a363 | https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/commands/inspect.js#L286-L298 |
3,659 | zeit/now-cli | src/commands/inspect.js | stateString | function stateString(s) {
switch (s) {
case 'INITIALIZING':
return chalk.yellow(s);
case 'ERROR':
return chalk.red(s);
case 'READY':
return s;
default:
return chalk.gray('UNKNOWN');
}
} | javascript | function stateString(s) {
switch (s) {
case 'INITIALIZING':
return chalk.yellow(s);
case 'ERROR':
return chalk.red(s);
case 'READY':
return s;
default:
return chalk.gray('UNKNOWN');
}
} | [
"function",
"stateString",
"(",
"s",
")",
"{",
"switch",
"(",
"s",
")",
"{",
"case",
"'INITIALIZING'",
":",
"return",
"chalk",
".",
"yellow",
"(",
"s",
")",
";",
"case",
"'ERROR'",
":",
"return",
"chalk",
".",
"red",
"(",
"s",
")",
";",
"case",
"'R... | renders the state string | [
"renders",
"the",
"state",
"string"
] | b53d907b745126113bc3e251ac2451088026a363 | https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/commands/inspect.js#L309-L323 |
3,660 | zeit/now-cli | src/commands/list.js | filterUniqueApps | function filterUniqueApps() {
const uniqueApps = new Set();
return function uniqueAppFilter([appName]) {
if (uniqueApps.has(appName)) {
return false;
}
uniqueApps.add(appName);
return true;
};
} | javascript | function filterUniqueApps() {
const uniqueApps = new Set();
return function uniqueAppFilter([appName]) {
if (uniqueApps.has(appName)) {
return false;
}
uniqueApps.add(appName);
return true;
};
} | [
"function",
"filterUniqueApps",
"(",
")",
"{",
"const",
"uniqueApps",
"=",
"new",
"Set",
"(",
")",
";",
"return",
"function",
"uniqueAppFilter",
"(",
"[",
"appName",
"]",
")",
"{",
"if",
"(",
"uniqueApps",
".",
"has",
"(",
"appName",
")",
")",
"{",
"re... | filters only one deployment per app, so that the user doesn't see so many deployments at once. this mode can be bypassed by supplying an app name | [
"filters",
"only",
"one",
"deployment",
"per",
"app",
"so",
"that",
"the",
"user",
"doesn",
"t",
"see",
"so",
"many",
"deployments",
"at",
"once",
".",
"this",
"mode",
"can",
"be",
"bypassed",
"by",
"supplying",
"an",
"app",
"name"
] | b53d907b745126113bc3e251ac2451088026a363 | https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/commands/list.js#L337-L346 |
3,661 | zeit/now-cli | src/util/hash.js | hashes | async function hashes(files) {
const map = new Map();
await Promise.all(
files.map(async name => {
const data = await fs.promises.readFile(name);
const h = hash(data);
const entry = map.get(h);
if (entry) {
entry.names.push(name);
} else {
map.set(hash(data), { na... | javascript | async function hashes(files) {
const map = new Map();
await Promise.all(
files.map(async name => {
const data = await fs.promises.readFile(name);
const h = hash(data);
const entry = map.get(h);
if (entry) {
entry.names.push(name);
} else {
map.set(hash(data), { na... | [
"async",
"function",
"hashes",
"(",
"files",
")",
"{",
"const",
"map",
"=",
"new",
"Map",
"(",
")",
";",
"await",
"Promise",
".",
"all",
"(",
"files",
".",
"map",
"(",
"async",
"name",
"=>",
"{",
"const",
"data",
"=",
"await",
"fs",
".",
"promises"... | Computes hashes for the contents of each file given.
@param {Array} of {String} full paths
@return {Map} | [
"Computes",
"hashes",
"for",
"the",
"contents",
"of",
"each",
"file",
"given",
"."
] | b53d907b745126113bc3e251ac2451088026a363 | https://github.com/zeit/now-cli/blob/b53d907b745126113bc3e251ac2451088026a363/src/util/hash.js#L14-L31 |
3,662 | Freeboard/freeboard | js/freeboard.thirdparty.js | function( element ) {
// if the element is already wrapped, return it
if ( element.parent().is( ".ui-effects-wrapper" )) {
return element.parent();
}
// wrap the element
var props = {
width: element.outerWidth(true),
height: element.outerHeight(true),
"float": element.css( "float" )
},
... | javascript | function( element ) {
// if the element is already wrapped, return it
if ( element.parent().is( ".ui-effects-wrapper" )) {
return element.parent();
}
// wrap the element
var props = {
width: element.outerWidth(true),
height: element.outerHeight(true),
"float": element.css( "float" )
},
... | [
"function",
"(",
"element",
")",
"{",
"// if the element is already wrapped, return it",
"if",
"(",
"element",
".",
"parent",
"(",
")",
".",
"is",
"(",
"\".ui-effects-wrapper\"",
")",
")",
"{",
"return",
"element",
".",
"parent",
"(",
")",
";",
"}",
"// wrap t... | Wraps the element around a wrapper that copies position properties | [
"Wraps",
"the",
"element",
"around",
"a",
"wrapper",
"that",
"copies",
"position",
"properties"
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L5734-L5807 | |
3,663 | Freeboard/freeboard | js/freeboard.thirdparty.js | function( value, allowAny ) {
var parsed;
if ( value !== "" ) {
parsed = this._parse( value );
if ( parsed !== null ) {
if ( !allowAny ) {
parsed = this._adjustValue( parsed );
}
value = this._format( parsed );
}
}
this.element.val( value );
this._refresh();
} | javascript | function( value, allowAny ) {
var parsed;
if ( value !== "" ) {
parsed = this._parse( value );
if ( parsed !== null ) {
if ( !allowAny ) {
parsed = this._adjustValue( parsed );
}
value = this._format( parsed );
}
}
this.element.val( value );
this._refresh();
} | [
"function",
"(",
"value",
",",
"allowAny",
")",
"{",
"var",
"parsed",
";",
"if",
"(",
"value",
"!==",
"\"\"",
")",
"{",
"parsed",
"=",
"this",
".",
"_parse",
"(",
"value",
")",
";",
"if",
"(",
"parsed",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
... | update the value without triggering change | [
"update",
"the",
"value",
"without",
"triggering",
"change"
] | 38789f6e8bd3d04f7d3b2c3427e509d00f2610fc | https://github.com/Freeboard/freeboard/blob/38789f6e8bd3d04f7d3b2c3427e509d00f2610fc/js/freeboard.thirdparty.js#L13730-L13743 | |
3,664 | testing-library/dom-testing-library | src/query-helpers.js | makeSingleQuery | function makeSingleQuery(allQuery, getMultipleError) {
return (container, ...args) => {
const els = allQuery(container, ...args)
if (els.length > 1) {
throw getMultipleElementsFoundError(
getMultipleError(container, ...args),
container,
)
}
return els[0] || null
}
} | javascript | function makeSingleQuery(allQuery, getMultipleError) {
return (container, ...args) => {
const els = allQuery(container, ...args)
if (els.length > 1) {
throw getMultipleElementsFoundError(
getMultipleError(container, ...args),
container,
)
}
return els[0] || null
}
} | [
"function",
"makeSingleQuery",
"(",
"allQuery",
",",
"getMultipleError",
")",
"{",
"return",
"(",
"container",
",",
"...",
"args",
")",
"=>",
"{",
"const",
"els",
"=",
"allQuery",
"(",
"container",
",",
"...",
"args",
")",
"if",
"(",
"els",
".",
"length"... | this accepts a query function and returns a function which throws an error if more than one elements is returned, otherwise it returns the first element or null | [
"this",
"accepts",
"a",
"query",
"function",
"and",
"returns",
"a",
"function",
"which",
"throws",
"an",
"error",
"if",
"more",
"than",
"one",
"elements",
"is",
"returned",
"otherwise",
"it",
"returns",
"the",
"first",
"element",
"or",
"null"
] | fcb2cbcffb7aff6ecff3be8731168c86eee82ce1 | https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/query-helpers.js#L68-L79 |
3,665 | testing-library/dom-testing-library | src/query-helpers.js | makeGetAllQuery | function makeGetAllQuery(allQuery, getMissingError) {
return (container, ...args) => {
const els = allQuery(container, ...args)
if (!els.length) {
throw getElementError(getMissingError(container, ...args), container)
}
return els
}
} | javascript | function makeGetAllQuery(allQuery, getMissingError) {
return (container, ...args) => {
const els = allQuery(container, ...args)
if (!els.length) {
throw getElementError(getMissingError(container, ...args), container)
}
return els
}
} | [
"function",
"makeGetAllQuery",
"(",
"allQuery",
",",
"getMissingError",
")",
"{",
"return",
"(",
"container",
",",
"...",
"args",
")",
"=>",
"{",
"const",
"els",
"=",
"allQuery",
"(",
"container",
",",
"...",
"args",
")",
"if",
"(",
"!",
"els",
".",
"l... | this accepts a query function and returns a function which throws an error if an empty list of elements is returned | [
"this",
"accepts",
"a",
"query",
"function",
"and",
"returns",
"a",
"function",
"which",
"throws",
"an",
"error",
"if",
"an",
"empty",
"list",
"of",
"elements",
"is",
"returned"
] | fcb2cbcffb7aff6ecff3be8731168c86eee82ce1 | https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/query-helpers.js#L83-L91 |
3,666 | testing-library/dom-testing-library | src/query-helpers.js | makeFindQuery | function makeFindQuery(getter) {
return (container, text, options, waitForElementOptions) =>
waitForElement(
() => getter(container, text, options),
waitForElementOptions,
)
} | javascript | function makeFindQuery(getter) {
return (container, text, options, waitForElementOptions) =>
waitForElement(
() => getter(container, text, options),
waitForElementOptions,
)
} | [
"function",
"makeFindQuery",
"(",
"getter",
")",
"{",
"return",
"(",
"container",
",",
"text",
",",
"options",
",",
"waitForElementOptions",
")",
"=>",
"waitForElement",
"(",
"(",
")",
"=>",
"getter",
"(",
"container",
",",
"text",
",",
"options",
")",
","... | this accepts a getter query function and returns a function which calls waitForElement and passing a function which invokes the getter. | [
"this",
"accepts",
"a",
"getter",
"query",
"function",
"and",
"returns",
"a",
"function",
"which",
"calls",
"waitForElement",
"and",
"passing",
"a",
"function",
"which",
"invokes",
"the",
"getter",
"."
] | fcb2cbcffb7aff6ecff3be8731168c86eee82ce1 | https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/query-helpers.js#L95-L101 |
3,667 | testing-library/dom-testing-library | src/matches.js | makeNormalizer | function makeNormalizer({trim, collapseWhitespace, normalizer}) {
if (normalizer) {
// User has specified a custom normalizer
if (
typeof trim !== 'undefined' ||
typeof collapseWhitespace !== 'undefined'
) {
// They've also specified a value for trim or collapseWhitespace
throw new... | javascript | function makeNormalizer({trim, collapseWhitespace, normalizer}) {
if (normalizer) {
// User has specified a custom normalizer
if (
typeof trim !== 'undefined' ||
typeof collapseWhitespace !== 'undefined'
) {
// They've also specified a value for trim or collapseWhitespace
throw new... | [
"function",
"makeNormalizer",
"(",
"{",
"trim",
",",
"collapseWhitespace",
",",
"normalizer",
"}",
")",
"{",
"if",
"(",
"normalizer",
")",
"{",
"// User has specified a custom normalizer",
"if",
"(",
"typeof",
"trim",
"!==",
"'undefined'",
"||",
"typeof",
"collaps... | Constructs a normalizer to pass to functions in matches.js
@param {boolean|undefined} trim The user-specified value for `trim`, without
any defaulting having been applied
@param {boolean|undefined} collapseWhitespace The user-specified value for
`collapseWhitespace`, without any defaulting having been applied
@param {F... | [
"Constructs",
"a",
"normalizer",
"to",
"pass",
"to",
"functions",
"in",
"matches",
".",
"js"
] | fcb2cbcffb7aff6ecff3be8731168c86eee82ce1 | https://github.com/testing-library/dom-testing-library/blob/fcb2cbcffb7aff6ecff3be8731168c86eee82ce1/src/matches.js#L51-L71 |
3,668 | muaz-khan/RecordRTC | RecordRTC.js | function(arrayOfWebPImages) {
config.advertisement = [];
var length = arrayOfWebPImages.length;
for (var i = 0; i < length; i++) {
config.advertisement.push({
duration: i,
image: arrayOfWebPImages[i]
});
... | javascript | function(arrayOfWebPImages) {
config.advertisement = [];
var length = arrayOfWebPImages.length;
for (var i = 0; i < length; i++) {
config.advertisement.push({
duration: i,
image: arrayOfWebPImages[i]
});
... | [
"function",
"(",
"arrayOfWebPImages",
")",
"{",
"config",
".",
"advertisement",
"=",
"[",
"]",
";",
"var",
"length",
"=",
"arrayOfWebPImages",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
... | This method appends an array of webp images to the recorded video-blob. It takes an "array" object.
@type {Array.<Array>}
@param {Array} arrayOfWebPImages - Array of webp images.
@method
@memberof RecordRTC
@instance
@todo This method should be deprecated.
@example
var arrayOfWebPImages = [];
arrayOfWebPImages.push({
d... | [
"This",
"method",
"appends",
"an",
"array",
"of",
"webp",
"images",
"to",
"the",
"recorded",
"video",
"-",
"blob",
".",
"It",
"takes",
"an",
"array",
"object",
"."
] | 3c6bad427b9da35c1cf617199ed13dda056c38ba | https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/RecordRTC.js#L606-L616 | |
3,669 | muaz-khan/RecordRTC | RecordRTC.js | function() {
if (mediaRecorder && typeof mediaRecorder.clearRecordedData === 'function') {
mediaRecorder.clearRecordedData();
}
mediaRecorder = null;
setState('inactive');
self.blob = null;
} | javascript | function() {
if (mediaRecorder && typeof mediaRecorder.clearRecordedData === 'function') {
mediaRecorder.clearRecordedData();
}
mediaRecorder = null;
setState('inactive');
self.blob = null;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"mediaRecorder",
"&&",
"typeof",
"mediaRecorder",
".",
"clearRecordedData",
"===",
"'function'",
")",
"{",
"mediaRecorder",
".",
"clearRecordedData",
"(",
")",
";",
"}",
"mediaRecorder",
"=",
"null",
";",
"setState",
"(",
... | This method resets the recorder. So that you can reuse single recorder instance many times.
@method
@memberof RecordRTC
@instance
@example
recorder.reset();
recorder.startRecording(); | [
"This",
"method",
"resets",
"the",
"recorder",
".",
"So",
"that",
"you",
"can",
"reuse",
"single",
"recorder",
"instance",
"many",
"times",
"."
] | 3c6bad427b9da35c1cf617199ed13dda056c38ba | https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/RecordRTC.js#L683-L690 | |
3,670 | muaz-khan/RecordRTC | RecordRTC.js | function() {
var self = this;
if (typeof indexedDB === 'undefined' || typeof indexedDB.open === 'undefined') {
console.error('IndexedDB API are not available in this browser.');
return;
}
var dbVersion = 1;
var dbName = this.dbName || location.href.repla... | javascript | function() {
var self = this;
if (typeof indexedDB === 'undefined' || typeof indexedDB.open === 'undefined') {
console.error('IndexedDB API are not available in this browser.');
return;
}
var dbVersion = 1;
var dbName = this.dbName || location.href.repla... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"typeof",
"indexedDB",
"===",
"'undefined'",
"||",
"typeof",
"indexedDB",
".",
"open",
"===",
"'undefined'",
")",
"{",
"console",
".",
"error",
"(",
"'IndexedDB API are not available in thi... | This method must be called once to initialize IndexedDB ObjectStore. Though, it is auto-used internally.
@method
@memberof DiskStorage
@internal
@example
DiskStorage.init(); | [
"This",
"method",
"must",
"be",
"called",
"once",
"to",
"initialize",
"IndexedDB",
"ObjectStore",
".",
"Though",
"it",
"is",
"auto",
"-",
"used",
"internally",
"."
] | 3c6bad427b9da35c1cf617199ed13dda056c38ba | https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/RecordRTC.js#L4388-L4456 | |
3,671 | muaz-khan/RecordRTC | RecordRTC.js | function(config) {
this.audioBlob = config.audioBlob;
this.videoBlob = config.videoBlob;
this.gifBlob = config.gifBlob;
this.init();
return this;
} | javascript | function(config) {
this.audioBlob = config.audioBlob;
this.videoBlob = config.videoBlob;
this.gifBlob = config.gifBlob;
this.init();
return this;
} | [
"function",
"(",
"config",
")",
"{",
"this",
".",
"audioBlob",
"=",
"config",
".",
"audioBlob",
";",
"this",
".",
"videoBlob",
"=",
"config",
".",
"videoBlob",
";",
"this",
".",
"gifBlob",
"=",
"config",
".",
"gifBlob",
";",
"this",
".",
"init",
"(",
... | This method stores blobs in IndexedDB.
@method
@memberof DiskStorage
@internal
@example
DiskStorage.Store({
audioBlob: yourAudioBlob,
videoBlob: yourVideoBlob,
gifBlob : yourGifBlob
}); | [
"This",
"method",
"stores",
"blobs",
"in",
"IndexedDB",
"."
] | 3c6bad427b9da35c1cf617199ed13dda056c38ba | https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/RecordRTC.js#L4487-L4495 | |
3,672 | muaz-khan/RecordRTC | WebGL-Recording/vendor/glge-compiled.js | getLastNumber | function getLastNumber(str){
var retval="";
for (var i=str.length-1;i>=0;--i)
if (str[i]>="0"&&str[i]<="9")
retval=str[i]+retval;
if (retval.length==0) return "0";
return retval;
} | javascript | function getLastNumber(str){
var retval="";
for (var i=str.length-1;i>=0;--i)
if (str[i]>="0"&&str[i]<="9")
retval=str[i]+retval;
if (retval.length==0) return "0";
return retval;
} | [
"function",
"getLastNumber",
"(",
"str",
")",
"{",
"var",
"retval",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"str",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"if",
"(",
"str",
"[",
"i",
"]",
">=",
"\"0\"",
"&&",... | the exporter is buggy eg VCGLab | MeshLab and does not specify input_set | [
"the",
"exporter",
"is",
"buggy",
"eg",
"VCGLab",
"|",
"MeshLab",
"and",
"does",
"not",
"specify",
"input_set"
] | 3c6bad427b9da35c1cf617199ed13dda056c38ba | https://github.com/muaz-khan/RecordRTC/blob/3c6bad427b9da35c1cf617199ed13dda056c38ba/WebGL-Recording/vendor/glge-compiled.js#L18122-L18129 |
3,673 | statsd/statsd | lib/mgmt_console.js | existing_stats | function existing_stats(stats_type, bucket){
matches = [];
//typical case: one-off, fully qualified
if (bucket in stats_type) {
matches.push(bucket);
}
//special case: match a whole 'folder' (and subfolders) of stats
if (bucket.slice(-2) == ".*") {
var folder = bucket.slice(0,-1);
for (var na... | javascript | function existing_stats(stats_type, bucket){
matches = [];
//typical case: one-off, fully qualified
if (bucket in stats_type) {
matches.push(bucket);
}
//special case: match a whole 'folder' (and subfolders) of stats
if (bucket.slice(-2) == ".*") {
var folder = bucket.slice(0,-1);
for (var na... | [
"function",
"existing_stats",
"(",
"stats_type",
",",
"bucket",
")",
"{",
"matches",
"=",
"[",
"]",
";",
"//typical case: one-off, fully qualified",
"if",
"(",
"bucket",
"in",
"stats_type",
")",
"{",
"matches",
".",
"push",
"(",
"bucket",
")",
";",
"}",
"//s... | existing_stats - find fully qualified matches for the requested stats bucket
@param stats_type array of all statistics of this type (eg~ timers) to match
@param bucket string to search on, which can be fully qualified,
or end in a .* to search for a folder, like stats.temp.*
@return array of fully qualified stats tha... | [
"existing_stats",
"-",
"find",
"fully",
"qualified",
"matches",
"for",
"the",
"requested",
"stats",
"bucket"
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/lib/mgmt_console.js#L46-L67 |
3,674 | statsd/statsd | backends/graphite.js | Metric | function Metric(key, value, ts) {
var m = this;
this.key = key;
this.value = value;
this.ts = ts;
// return a string representation of this metric appropriate
// for sending to the graphite collector. does not include
// a trailing newline.
this.toText = function() {
return m.key + " " + m.value +... | javascript | function Metric(key, value, ts) {
var m = this;
this.key = key;
this.value = value;
this.ts = ts;
// return a string representation of this metric appropriate
// for sending to the graphite collector. does not include
// a trailing newline.
this.toText = function() {
return m.key + " " + m.value +... | [
"function",
"Metric",
"(",
"key",
",",
"value",
",",
"ts",
")",
"{",
"var",
"m",
"=",
"this",
";",
"this",
".",
"key",
"=",
"key",
";",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"ts",
"=",
"ts",
";",
"// return a string representation of ... | A single measurement for sending to graphite. | [
"A",
"single",
"measurement",
"for",
"sending",
"to",
"graphite",
"."
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/backends/graphite.js#L105-L121 |
3,675 | statsd/statsd | backends/graphite.js | Stats | function Stats() {
var s = this;
this.metrics = [];
this.add = function(key, value, ts) {
s.metrics.push(new Metric(key, value, ts));
};
this.toText = function() {
return s.metrics.map(function(m) { return m.toText(); }).join('\n') + '\n';
};
this.toPickle = function() {
var body = MARK + LI... | javascript | function Stats() {
var s = this;
this.metrics = [];
this.add = function(key, value, ts) {
s.metrics.push(new Metric(key, value, ts));
};
this.toText = function() {
return s.metrics.map(function(m) { return m.toText(); }).join('\n') + '\n';
};
this.toPickle = function() {
var body = MARK + LI... | [
"function",
"Stats",
"(",
")",
"{",
"var",
"s",
"=",
"this",
";",
"this",
".",
"metrics",
"=",
"[",
"]",
";",
"this",
".",
"add",
"=",
"function",
"(",
"key",
",",
"value",
",",
"ts",
")",
"{",
"s",
".",
"metrics",
".",
"push",
"(",
"new",
"M... | A collection of measurements for sending to graphite. | [
"A",
"collection",
"of",
"measurements",
"for",
"sending",
"to",
"graphite",
"."
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/backends/graphite.js#L124-L148 |
3,676 | statsd/statsd | backends/graphite.js | sk | function sk(key) {
if (globalKeySanitize) {
return key;
} else {
return key.replace(/\s+/g, '_')
.replace(/\//g, '-')
.replace(/[^a-zA-Z_\-0-9\.]/g, '');
}
} | javascript | function sk(key) {
if (globalKeySanitize) {
return key;
} else {
return key.replace(/\s+/g, '_')
.replace(/\//g, '-')
.replace(/[^a-zA-Z_\-0-9\.]/g, '');
}
} | [
"function",
"sk",
"(",
"key",
")",
"{",
"if",
"(",
"globalKeySanitize",
")",
"{",
"return",
"key",
";",
"}",
"else",
"{",
"return",
"key",
".",
"replace",
"(",
"/",
"\\s+",
"/",
"g",
",",
"'_'",
")",
".",
"replace",
"(",
"/",
"\\/",
"/",
"g",
"... | Sanitize key for graphite if not done globally | [
"Sanitize",
"key",
"for",
"graphite",
"if",
"not",
"done",
"globally"
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/backends/graphite.js#L164-L172 |
3,677 | statsd/statsd | proxy.js | healthcheck | function healthcheck(node) {
var ended = false;
var node_id = node.host + ':' + node.port;
var client = net.connect(
{port: node.adminport, host: node.host},
function onConnect() {
if (!ended) {
client.write('health\r\n');
}
}
);
client.setTimeout(healthC... | javascript | function healthcheck(node) {
var ended = false;
var node_id = node.host + ':' + node.port;
var client = net.connect(
{port: node.adminport, host: node.host},
function onConnect() {
if (!ended) {
client.write('health\r\n');
}
}
);
client.setTimeout(healthC... | [
"function",
"healthcheck",
"(",
"node",
")",
"{",
"var",
"ended",
"=",
"false",
";",
"var",
"node_id",
"=",
"node",
".",
"host",
"+",
"':'",
"+",
"node",
".",
"port",
";",
"var",
"client",
"=",
"net",
".",
"connect",
"(",
"{",
"port",
":",
"node",
... | Perform health check on node | [
"Perform",
"health",
"check",
"on",
"node"
] | ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9 | https://github.com/statsd/statsd/blob/ef8e4d76d76c3a0cf771e3724cf79ea22f3c50d9/proxy.js#L255-L301 |
3,678 | SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/model/formatter.js | function (sLink) {
if (sLink[0] === "#") {
sLink = document.location.href.substring(0,document.location.href.search("demoapps\.html")) + sLink;
}
return sLink;
} | javascript | function (sLink) {
if (sLink[0] === "#") {
sLink = document.location.href.substring(0,document.location.href.search("demoapps\.html")) + sLink;
}
return sLink;
} | [
"function",
"(",
"sLink",
")",
"{",
"if",
"(",
"sLink",
"[",
"0",
"]",
"===",
"\"#\"",
")",
"{",
"sLink",
"=",
"document",
".",
"location",
".",
"href",
".",
"substring",
"(",
"0",
",",
"document",
".",
"location",
".",
"href",
".",
"search",
"(",
... | Formats a library namespace to link to the API reference if it starts with sap.
@public
@param {string} sNamespace value to be formatted
@returns {string} formatted link | [
"Formats",
"a",
"library",
"namespace",
"to",
"link",
"to",
"the",
"API",
"reference",
"if",
"it",
"starts",
"with",
"sap",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/model/formatter.js#L16-L21 | |
3,679 | SAP/openui5 | src/sap.uxap/src/sap/uxap/ThrottledTaskHelper.js | function(oOldOptions, oNewOptions) {
var oMergedOptions = jQuery.extend({}, oOldOptions, oNewOptions);
jQuery.each(oMergedOptions, function(key) {
oMergedOptions[key] = oOldOptions[key] || oNewOptions[key]; // default merge strategy is inclusive OR
});
return oMergedOptions;
} | javascript | function(oOldOptions, oNewOptions) {
var oMergedOptions = jQuery.extend({}, oOldOptions, oNewOptions);
jQuery.each(oMergedOptions, function(key) {
oMergedOptions[key] = oOldOptions[key] || oNewOptions[key]; // default merge strategy is inclusive OR
});
return oMergedOptions;
} | [
"function",
"(",
"oOldOptions",
",",
"oNewOptions",
")",
"{",
"var",
"oMergedOptions",
"=",
"jQuery",
".",
"extend",
"(",
"{",
"}",
",",
"oOldOptions",
",",
"oNewOptions",
")",
";",
"jQuery",
".",
"each",
"(",
"oMergedOptions",
",",
"function",
"(",
"key",... | Updates the task arguments
Default merge strategy is inclusive OR
@private | [
"Updates",
"the",
"task",
"arguments",
"Default",
"merge",
"strategy",
"is",
"inclusive",
"OR"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.uxap/src/sap/uxap/ThrottledTaskHelper.js#L95-L103 | |
3,680 | SAP/openui5 | src/sap.ui.dt/src/sap/ui/dt/ElementOverlay.js | function(oChild1, oChild2) {
var oGeometry1 = DOMUtil.getGeometry(oChild1);
var oGeometry2 = DOMUtil.getGeometry(oChild2);
var oPosition1 = oGeometry1 && oGeometry1.position;
var oPosition2 = oGeometry2 && oGeometry2.position;
if (oPosition1 && oPosition2) {
var iBottom1 = oPosition1.top + oGeometry... | javascript | function(oChild1, oChild2) {
var oGeometry1 = DOMUtil.getGeometry(oChild1);
var oGeometry2 = DOMUtil.getGeometry(oChild2);
var oPosition1 = oGeometry1 && oGeometry1.position;
var oPosition2 = oGeometry2 && oGeometry2.position;
if (oPosition1 && oPosition2) {
var iBottom1 = oPosition1.top + oGeometry... | [
"function",
"(",
"oChild1",
",",
"oChild2",
")",
"{",
"var",
"oGeometry1",
"=",
"DOMUtil",
".",
"getGeometry",
"(",
"oChild1",
")",
";",
"var",
"oGeometry2",
"=",
"DOMUtil",
".",
"getGeometry",
"(",
"oChild2",
")",
";",
"var",
"oPosition1",
"=",
"oGeometry... | compares two DOM Nodes and returns 1, if first child should be bellow in dom order | [
"compares",
"two",
"DOM",
"Nodes",
"and",
"returns",
"1",
"if",
"first",
"child",
"should",
"be",
"bellow",
"in",
"dom",
"order"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.dt/src/sap/ui/dt/ElementOverlay.js#L388-L453 | |
3,681 | SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/App.controller.js | function() {
var oViewModel = this.getModel("appView"),
bPhoneSize = oViewModel.getProperty("/bPhoneSize");
// Version switch should not be shown on phone sizes or when no versions are found
oViewModel.setProperty("/bShowVersionSwitchInHeader", !bPhoneSize && !!this._aNeoAppVersions);
oViewModel.s... | javascript | function() {
var oViewModel = this.getModel("appView"),
bPhoneSize = oViewModel.getProperty("/bPhoneSize");
// Version switch should not be shown on phone sizes or when no versions are found
oViewModel.setProperty("/bShowVersionSwitchInHeader", !bPhoneSize && !!this._aNeoAppVersions);
oViewModel.s... | [
"function",
"(",
")",
"{",
"var",
"oViewModel",
"=",
"this",
".",
"getModel",
"(",
"\"appView\"",
")",
",",
"bPhoneSize",
"=",
"oViewModel",
".",
"getProperty",
"(",
"\"/bPhoneSize\"",
")",
";",
"// Version switch should not be shown on phone sizes or when no versions a... | Determines whether or not to show the version change button.
@private | [
"Determines",
"whether",
"or",
"not",
"to",
"show",
"the",
"version",
"change",
"button",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/App.controller.js#L414-L421 | |
3,682 | SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/App.controller.js | function () {
var that = this;
if (!this._oFeedbackDialog) {
this._oFeedbackDialog = new sap.ui.xmlfragment("feedbackDialogFragment", "sap.ui.documentation.sdk.view.FeedbackDialog", this);
this._oView.addDependent(this._oFeedbackDialog);
this._oFeedbackDialog.textInput = Fragment.byId("feedback... | javascript | function () {
var that = this;
if (!this._oFeedbackDialog) {
this._oFeedbackDialog = new sap.ui.xmlfragment("feedbackDialogFragment", "sap.ui.documentation.sdk.view.FeedbackDialog", this);
this._oView.addDependent(this._oFeedbackDialog);
this._oFeedbackDialog.textInput = Fragment.byId("feedback... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"if",
"(",
"!",
"this",
".",
"_oFeedbackDialog",
")",
"{",
"this",
".",
"_oFeedbackDialog",
"=",
"new",
"sap",
".",
"ui",
".",
"xmlfragment",
"(",
"\"feedbackDialogFragment\"",
",",
"\"sap.ui.docu... | Opens a dialog to give feedback on the demo kit | [
"Opens",
"a",
"dialog",
"to",
"give",
"feedback",
"on",
"the",
"demo",
"kit"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/App.controller.js#L441-L508 | |
3,683 | SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/App.controller.js | function() {
var data = {};
if (this._oFeedbackDialog.contextCheckBox.getSelected()) {
data = {
"texts": {
"t1": this._oFeedbackDialog.textInput.getValue()
},
"ratings":{
"r1": {"value" : this._oFeedbackDialog.ratingStatus.value}
},
"context": {"page": this._get... | javascript | function() {
var data = {};
if (this._oFeedbackDialog.contextCheckBox.getSelected()) {
data = {
"texts": {
"t1": this._oFeedbackDialog.textInput.getValue()
},
"ratings":{
"r1": {"value" : this._oFeedbackDialog.ratingStatus.value}
},
"context": {"page": this._get... | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"{",
"}",
";",
"if",
"(",
"this",
".",
"_oFeedbackDialog",
".",
"contextCheckBox",
".",
"getSelected",
"(",
")",
")",
"{",
"data",
"=",
"{",
"\"texts\"",
":",
"{",
"\"t1\"",
":",
"this",
".",
"_oFeedback... | Event handler for the send feedback button | [
"Event",
"handler",
"for",
"the",
"send",
"feedback",
"button"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/App.controller.js#L513-L564 | |
3,684 | SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/App.controller.js | function(oEvent) {
var that = this;
var oPressedButton = oEvent.getSource();
that._oFeedbackDialog.ratingBar.forEach(function(oRatingBarElement) {
if (oPressedButton !== oRatingBarElement.button) {
oRatingBarElement.button.setPressed(false);
} else {
if (!oRatingBarElement.button.getP... | javascript | function(oEvent) {
var that = this;
var oPressedButton = oEvent.getSource();
that._oFeedbackDialog.ratingBar.forEach(function(oRatingBarElement) {
if (oPressedButton !== oRatingBarElement.button) {
oRatingBarElement.button.setPressed(false);
} else {
if (!oRatingBarElement.button.getP... | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"oPressedButton",
"=",
"oEvent",
".",
"getSource",
"(",
")",
";",
"that",
".",
"_oFeedbackDialog",
".",
"ratingBar",
".",
"forEach",
"(",
"function",
"(",
"oRatingBarElement",
")"... | Event handler for the rating to update the label and the data
@param {sap.ui.base.Event} | [
"Event",
"handler",
"for",
"the",
"rating",
"to",
"update",
"the",
"label",
"and",
"the",
"data"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/App.controller.js#L592-L633 | |
3,685 | SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/hasher.js | function(path){
// ##### BEGIN: MODIFIED BY SAP
var dispatchFunction;
// ##### END: MODIFIED BY SAP
path = _makePath.apply(null, arguments);
if(path !== _hash){
// we should store raw value
// ##### BEGIN: MODIFIED BY SAP
dispatchFunction = _registerChange(path);
if (!h... | javascript | function(path){
// ##### BEGIN: MODIFIED BY SAP
var dispatchFunction;
// ##### END: MODIFIED BY SAP
path = _makePath.apply(null, arguments);
if(path !== _hash){
// we should store raw value
// ##### BEGIN: MODIFIED BY SAP
dispatchFunction = _registerChange(path);
if (!h... | [
"function",
"(",
"path",
")",
"{",
"// ##### BEGIN: MODIFIED BY SAP",
"var",
"dispatchFunction",
";",
"// ##### END: MODIFIED BY SAP",
"path",
"=",
"_makePath",
".",
"apply",
"(",
"null",
",",
"arguments",
")",
";",
"if",
"(",
"path",
"!==",
"_hash",
")",
"{",
... | Set Hash value, generating a new history record.
@param {...string} path Hash value without '#'. Hasher will join
path segments using `hasher.separator` and prepend/append hash value
with `hasher.appendHash` and `hasher.prependHash`
@example hasher.setHash('lorem', 'ipsum', 'dolor') -> '#/lorem/ipsum/dolor' | [
"Set",
"Hash",
"value",
"generating",
"a",
"new",
"history",
"record",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/hasher.js#L361-L378 | |
3,686 | SAP/openui5 | src/sap.ui.demokit/src/sap/ui/demokit/util/jsanalyzer/Doclet.js | Doclet | function Doclet(comment) {
this.comment = comment = unwrap(comment);
this.tags = [];
var m;
var lastContent = 0;
var lastTag = "description";
while ((m = rtag.exec(comment)) != null) {
this._addTag(lastTag, comment.slice(lastContent, m.index));
lastTag = m[2];
lastContent = rtag.lastInde... | javascript | function Doclet(comment) {
this.comment = comment = unwrap(comment);
this.tags = [];
var m;
var lastContent = 0;
var lastTag = "description";
while ((m = rtag.exec(comment)) != null) {
this._addTag(lastTag, comment.slice(lastContent, m.index));
lastTag = m[2];
lastContent = rtag.lastInde... | [
"function",
"Doclet",
"(",
"comment",
")",
"{",
"this",
".",
"comment",
"=",
"comment",
"=",
"unwrap",
"(",
"comment",
")",
";",
"this",
".",
"tags",
"=",
"[",
"]",
";",
"var",
"m",
";",
"var",
"lastContent",
"=",
"0",
";",
"var",
"lastTag",
"=",
... | Creates a Doclet from the given comment string
@param {string} comment Comment string.
@constructor
@private | [
"Creates",
"a",
"Doclet",
"from",
"the",
"given",
"comment",
"string"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/util/jsanalyzer/Doclet.js#L42-L56 |
3,687 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Control.js | fnAppendBusyIndicator | function fnAppendBusyIndicator() {
// Only append if busy state is still set
if (!this.getBusy()) {
return;
}
var $this = this.$(this._sBusySection);
//If there is a pending delayed call to append the busy indicator, we can clear it now
if (this._busyIndicatorDelayedCallId) {
clearTimeout(this._bus... | javascript | function fnAppendBusyIndicator() {
// Only append if busy state is still set
if (!this.getBusy()) {
return;
}
var $this = this.$(this._sBusySection);
//If there is a pending delayed call to append the busy indicator, we can clear it now
if (this._busyIndicatorDelayedCallId) {
clearTimeout(this._bus... | [
"function",
"fnAppendBusyIndicator",
"(",
")",
"{",
"// Only append if busy state is still set",
"if",
"(",
"!",
"this",
".",
"getBusy",
"(",
")",
")",
"{",
"return",
";",
"}",
"var",
"$this",
"=",
"this",
".",
"$",
"(",
"this",
".",
"_sBusySection",
")",
... | Add busy indicator to DOM
@private | [
"Add",
"busy",
"indicator",
"to",
"DOM"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Control.js#L721-L759 |
3,688 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Control.js | fnAddStandaloneBlockLayer | function fnAddStandaloneBlockLayer () {
this._oBlockState = BlockLayerUtils.block(this, this.getId() + "-blockedLayer", this._sBlockSection);
jQuery(this._oBlockState.$blockLayer.get(0)).addClass("sapUiBlockLayerOnly");
} | javascript | function fnAddStandaloneBlockLayer () {
this._oBlockState = BlockLayerUtils.block(this, this.getId() + "-blockedLayer", this._sBlockSection);
jQuery(this._oBlockState.$blockLayer.get(0)).addClass("sapUiBlockLayerOnly");
} | [
"function",
"fnAddStandaloneBlockLayer",
"(",
")",
"{",
"this",
".",
"_oBlockState",
"=",
"BlockLayerUtils",
".",
"block",
"(",
"this",
",",
"this",
".",
"getId",
"(",
")",
"+",
"\"-blockedLayer\"",
",",
"this",
".",
"_sBlockSection",
")",
";",
"jQuery",
"("... | Adds a standalone block-layer. Might be shared with a BusyIndicator later on. | [
"Adds",
"a",
"standalone",
"block",
"-",
"layer",
".",
"Might",
"be",
"shared",
"with",
"a",
"BusyIndicator",
"later",
"on",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Control.js#L764-L767 |
3,689 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Control.js | fnAddStandaloneBusyIndicator | function fnAddStandaloneBusyIndicator () {
this._oBusyBlockState = BlockLayerUtils.block(this, this.getId() + "-busyIndicator", this._sBusySection);
BusyIndicatorUtils.addHTML(this._oBusyBlockState, this.getBusyIndicatorSize());
} | javascript | function fnAddStandaloneBusyIndicator () {
this._oBusyBlockState = BlockLayerUtils.block(this, this.getId() + "-busyIndicator", this._sBusySection);
BusyIndicatorUtils.addHTML(this._oBusyBlockState, this.getBusyIndicatorSize());
} | [
"function",
"fnAddStandaloneBusyIndicator",
"(",
")",
"{",
"this",
".",
"_oBusyBlockState",
"=",
"BlockLayerUtils",
".",
"block",
"(",
"this",
",",
"this",
".",
"getId",
"(",
")",
"+",
"\"-busyIndicator\"",
",",
"this",
".",
"_sBusySection",
")",
";",
"BusyInd... | Adds a standalone BusyIndicator.
The block-layer code is able to recognize that a new block-layer is not needed. | [
"Adds",
"a",
"standalone",
"BusyIndicator",
".",
"The",
"block",
"-",
"layer",
"code",
"is",
"able",
"to",
"recognize",
"that",
"a",
"new",
"block",
"-",
"layer",
"is",
"not",
"needed",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Control.js#L773-L776 |
3,690 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/Control.js | fnRemoveBusyIndicator | function fnRemoveBusyIndicator(bForceRemoval) {
// removing all block layers is done upon rerendering and destroy of the control
if (bForceRemoval) {
fnRemoveAllBlockLayers.call(this);
return;
}
var $this = this.$(this._sBusySection);
$this.removeClass('sapUiLocalBusy');
//Unset the actual DOM Eleme... | javascript | function fnRemoveBusyIndicator(bForceRemoval) {
// removing all block layers is done upon rerendering and destroy of the control
if (bForceRemoval) {
fnRemoveAllBlockLayers.call(this);
return;
}
var $this = this.$(this._sBusySection);
$this.removeClass('sapUiLocalBusy');
//Unset the actual DOM Eleme... | [
"function",
"fnRemoveBusyIndicator",
"(",
"bForceRemoval",
")",
"{",
"// removing all block layers is done upon rerendering and destroy of the control",
"if",
"(",
"bForceRemoval",
")",
"{",
"fnRemoveAllBlockLayers",
".",
"call",
"(",
"this",
")",
";",
"return",
";",
"}",
... | Remove busy indicator from DOM
@param {boolean} bForceRemoval Forces the removal of all Block layers
@private | [
"Remove",
"busy",
"indicator",
"from",
"DOM"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Control.js#L796-L831 |
3,691 | SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/ODataMessageParser.js | filterDuplicates | function filterDuplicates(/*ref*/ aMessages){
if (aMessages.length > 1) {
for (var iIndex = 1; iIndex < aMessages.length; iIndex++) {
if (aMessages[0].getCode() == aMessages[iIndex].getCode() && aMessages[0].getMessage() == aMessages[iIndex].getMessage()) {
aMessages.shift(); // Remove outer error, since ... | javascript | function filterDuplicates(/*ref*/ aMessages){
if (aMessages.length > 1) {
for (var iIndex = 1; iIndex < aMessages.length; iIndex++) {
if (aMessages[0].getCode() == aMessages[iIndex].getCode() && aMessages[0].getMessage() == aMessages[iIndex].getMessage()) {
aMessages.shift(); // Remove outer error, since ... | [
"function",
"filterDuplicates",
"(",
"/*ref*/",
"aMessages",
")",
"{",
"if",
"(",
"aMessages",
".",
"length",
">",
"1",
")",
"{",
"for",
"(",
"var",
"iIndex",
"=",
"1",
";",
"iIndex",
"<",
"aMessages",
".",
"length",
";",
"iIndex",
"++",
")",
"{",
"i... | The message container returned by the backend could contain duplicate messages in some scenarios.
The outer error could be identical to an inner error. This makes sense when the outer error is only though as error message container
for the inner errors and therefore shouldn't be end up in a seperate UI message.
This f... | [
"The",
"message",
"container",
"returned",
"by",
"the",
"backend",
"could",
"contain",
"duplicate",
"messages",
"in",
"some",
"scenarios",
".",
"The",
"outer",
"error",
"could",
"be",
"identical",
"to",
"an",
"inner",
"error",
".",
"This",
"makes",
"sense",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/ODataMessageParser.js#L892-L901 |
3,692 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/date/Buddhist.js | toBuddhist | function toBuddhist(oGregorian) {
var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Buddhist, 0).year,
iYear = oGregorian.year - iEraStartYear + 1;
// Before 1941 new year started on 1st of April
if (oGregorian.year < 1941 && oGregorian.month < 3) {
iYear -= 1;
}
if (oGregorian.year === nul... | javascript | function toBuddhist(oGregorian) {
var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Buddhist, 0).year,
iYear = oGregorian.year - iEraStartYear + 1;
// Before 1941 new year started on 1st of April
if (oGregorian.year < 1941 && oGregorian.month < 3) {
iYear -= 1;
}
if (oGregorian.year === nul... | [
"function",
"toBuddhist",
"(",
"oGregorian",
")",
"{",
"var",
"iEraStartYear",
"=",
"UniversalDate",
".",
"getEraStartDate",
"(",
"CalendarType",
".",
"Buddhist",
",",
"0",
")",
".",
"year",
",",
"iYear",
"=",
"oGregorian",
".",
"year",
"-",
"iEraStartYear",
... | Find the matching Buddhist date for the given gregorian date
@param {object} oGregorian
@return {object} | [
"Find",
"the",
"matching",
"Buddhist",
"date",
"for",
"the",
"given",
"gregorian",
"date"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Buddhist.js#L48-L63 |
3,693 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/date/Buddhist.js | toGregorian | function toGregorian(oBuddhist) {
var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Buddhist, 0).year,
iYear = oBuddhist.year + iEraStartYear - 1;
// Before 1941 new year started on 1st of April
if (iYear < 1941 && oBuddhist.month < 3) {
iYear += 1;
}
if (oBuddhist.year === null) {
iYear... | javascript | function toGregorian(oBuddhist) {
var iEraStartYear = UniversalDate.getEraStartDate(CalendarType.Buddhist, 0).year,
iYear = oBuddhist.year + iEraStartYear - 1;
// Before 1941 new year started on 1st of April
if (iYear < 1941 && oBuddhist.month < 3) {
iYear += 1;
}
if (oBuddhist.year === null) {
iYear... | [
"function",
"toGregorian",
"(",
"oBuddhist",
")",
"{",
"var",
"iEraStartYear",
"=",
"UniversalDate",
".",
"getEraStartDate",
"(",
"CalendarType",
".",
"Buddhist",
",",
"0",
")",
".",
"year",
",",
"iYear",
"=",
"oBuddhist",
".",
"year",
"+",
"iEraStartYear",
... | Calculate gregorian year from Buddhist year and month
@param {object} oBuddhist
@return {int} | [
"Calculate",
"gregorian",
"year",
"from",
"Buddhist",
"year",
"and",
"month"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Buddhist.js#L71-L86 |
3,694 | SAP/openui5 | src/sap.ui.core/src/sap/ui/core/date/Buddhist.js | toGregorianArguments | function toGregorianArguments(aArgs) {
var oBuddhist, oGregorian;
oBuddhist = {
year: aArgs[0],
month: aArgs[1],
day: aArgs[2] !== undefined ? aArgs[2] : 1
};
oGregorian = toGregorian(oBuddhist);
aArgs[0] = oGregorian.year;
return aArgs;
} | javascript | function toGregorianArguments(aArgs) {
var oBuddhist, oGregorian;
oBuddhist = {
year: aArgs[0],
month: aArgs[1],
day: aArgs[2] !== undefined ? aArgs[2] : 1
};
oGregorian = toGregorian(oBuddhist);
aArgs[0] = oGregorian.year;
return aArgs;
} | [
"function",
"toGregorianArguments",
"(",
"aArgs",
")",
"{",
"var",
"oBuddhist",
",",
"oGregorian",
";",
"oBuddhist",
"=",
"{",
"year",
":",
"aArgs",
"[",
"0",
"]",
",",
"month",
":",
"aArgs",
"[",
"1",
"]",
",",
"day",
":",
"aArgs",
"[",
"2",
"]",
... | Convert arguments array from Buddhist date to gregorian data
@param {object} oBuddhist
@return {int} | [
"Convert",
"arguments",
"array",
"from",
"Buddhist",
"date",
"to",
"gregorian",
"data"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Buddhist.js#L94-L104 |
3,695 | SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/util/Utils.js | function (oVersionInfo) {
var bResult = false,
sFrameworkInfo = "";
try {
sFrameworkInfo = oVersionInfo.gav ? oVersionInfo.gav : oVersionInfo.name;
bResult = sFrameworkInfo.indexOf('openui5') !== -1 ? true : false;
} catch (e) {
return bResult;
}
return bResult;
} | javascript | function (oVersionInfo) {
var bResult = false,
sFrameworkInfo = "";
try {
sFrameworkInfo = oVersionInfo.gav ? oVersionInfo.gav : oVersionInfo.name;
bResult = sFrameworkInfo.indexOf('openui5') !== -1 ? true : false;
} catch (e) {
return bResult;
}
return bResult;
} | [
"function",
"(",
"oVersionInfo",
")",
"{",
"var",
"bResult",
"=",
"false",
",",
"sFrameworkInfo",
"=",
"\"\"",
";",
"try",
"{",
"sFrameworkInfo",
"=",
"oVersionInfo",
".",
"gav",
"?",
"oVersionInfo",
".",
"gav",
":",
"oVersionInfo",
".",
"name",
";",
"bRes... | Checks the distribution of UI5 that the Application is using
@public
@param {object} oVersionInfo information about the UI5 freawork used by the Application
@returns {boolean} result true if the distribution of application is OPENUI5 | [
"Checks",
"the",
"distribution",
"of",
"UI5",
"that",
"the",
"Application",
"is",
"using"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/util/Utils.js#L23-L35 | |
3,696 | SAP/openui5 | src/sap.ui.support/src/sap/ui/support/supportRules/util/Utils.js | function () {
var that = this;
var oInternalRulesPromise = new Promise(function (resolve) {
if (that.bCanLoadInternalRules !== null) {
resolve(that.bCanLoadInternalRules);
return;
}
jQuery.ajax({
type: "HEAD",
url: sInternalPingFilePath,
success: function () {
... | javascript | function () {
var that = this;
var oInternalRulesPromise = new Promise(function (resolve) {
if (that.bCanLoadInternalRules !== null) {
resolve(that.bCanLoadInternalRules);
return;
}
jQuery.ajax({
type: "HEAD",
url: sInternalPingFilePath,
success: function () {
... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"oInternalRulesPromise",
"=",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
")",
"{",
"if",
"(",
"that",
".",
"bCanLoadInternalRules",
"!==",
"null",
")",
"{",
"resolve",
"(",
"that"... | Checks if there are internal rules files that has to be loaded
@returns {Promise} The returned promise resolves with an argument showing
whether internal rules can be loaded or not | [
"Checks",
"if",
"there",
"are",
"internal",
"rules",
"files",
"that",
"has",
"to",
"be",
"loaded"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/util/Utils.js#L68-L95 | |
3,697 | SAP/openui5 | src/sap.ui.layout/src/sap/ui/layout/form/ColumnLayout.js | function(aRows, iField, oLD, oOptions, iLabelSize) {
var iRemain = 0;
var oRow;
for (i = 0; i < aRows.length; i++) {
if (iField >= aRows[i].first && iField <= aRows[i].last) {
oRow = aRows[i];
break;
}
}
if (!oLD) {
oOptions.Size = Math.floor(oRow.availableCell... | javascript | function(aRows, iField, oLD, oOptions, iLabelSize) {
var iRemain = 0;
var oRow;
for (i = 0; i < aRows.length; i++) {
if (iField >= aRows[i].first && iField <= aRows[i].last) {
oRow = aRows[i];
break;
}
}
if (!oLD) {
oOptions.Size = Math.floor(oRow.availableCell... | [
"function",
"(",
"aRows",
",",
"iField",
",",
"oLD",
",",
"oOptions",
",",
"iLabelSize",
")",
"{",
"var",
"iRemain",
"=",
"0",
";",
"var",
"oRow",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"aRows",
".",
"length",
";",
"i",
"++",
")",
"{",
... | determine size of Field | [
"determine",
"size",
"of",
"Field"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/ColumnLayout.js#L506-L533 | |
3,698 | SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js | sanitizeHistorySensitive | function sanitizeHistorySensitive(blockOfProperties) {
var elide = false;
for (var i = 0, n = blockOfProperties.length; i < n-1; ++i) {
var token = blockOfProperties[i];
if (':' === blockOfProperties[i+1]) {
elide = !(cssSchema[token].cssPropBits & CSS_PROP_BIT_ALLOWED_IN_LINK);
}
... | javascript | function sanitizeHistorySensitive(blockOfProperties) {
var elide = false;
for (var i = 0, n = blockOfProperties.length; i < n-1; ++i) {
var token = blockOfProperties[i];
if (':' === blockOfProperties[i+1]) {
elide = !(cssSchema[token].cssPropBits & CSS_PROP_BIT_ALLOWED_IN_LINK);
}
... | [
"function",
"sanitizeHistorySensitive",
"(",
"blockOfProperties",
")",
"{",
"var",
"elide",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"n",
"=",
"blockOfProperties",
".",
"length",
";",
"i",
"<",
"n",
"-",
"1",
";",
"++",
"i",
")",
"{"... | Given a series of sanitized tokens, removes any properties that would
leak user history if allowed to style links differently depending on
whether the linked URL is in the user's browser history.
@param {Array.<string>} blockOfProperties | [
"Given",
"a",
"series",
"of",
"sanitized",
"tokens",
"removes",
"any",
"properties",
"that",
"would",
"leak",
"user",
"history",
"if",
"allowed",
"to",
"style",
"links",
"differently",
"depending",
"on",
"whether",
"the",
"linked",
"URL",
"is",
"in",
"the",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js#L1493-L1504 |
3,699 | SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js | escapeAttrib | function escapeAttrib(s) {
return ('' + s).replace(ampRe, '&').replace(ltRe, '<')
.replace(gtRe, '>').replace(quotRe, '"');
} | javascript | function escapeAttrib(s) {
return ('' + s).replace(ampRe, '&').replace(ltRe, '<')
.replace(gtRe, '>').replace(quotRe, '"');
} | [
"function",
"escapeAttrib",
"(",
"s",
")",
"{",
"return",
"(",
"''",
"+",
"s",
")",
".",
"replace",
"(",
"ampRe",
",",
"'&'",
")",
".",
"replace",
"(",
"ltRe",
",",
"'<'",
")",
".",
"replace",
"(",
"gtRe",
",",
"'>'",
")",
".",
"replace",... | Escapes HTML special characters in attribute values.
{\@updoc
$ escapeAttrib('')
# ''
$ escapeAttrib('"<<&==&>>"') // Do not just escape the first occurrence.
# '"<<&==&>>"'
$ escapeAttrib('Hello <World>!')
# 'Hello <World>!'
} | [
"Escapes",
"HTML",
"special",
"characters",
"in",
"attribute",
"values",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/caja-html-sanitizer.js#L2842-L2845 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.