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
partition
stringclasses
1 value
pbeshai/react-url-query
examples/redux-with-actions/src/MainPage.js
mapDispatchToProps
function mapDispatchToProps(dispatch) { return { onChangeArr: (arr) => dispatch(changeArr(arr)), onChangeFoo: (foo) => dispatch(changeFoo(foo)), onChangeBar: (bar) => dispatch(changeBar(bar)), onChangeBaz: (baz) => dispatch(changeBaz(baz)), onChangeMany: (foo) => dispatch(changeMany({ foo })), }...
javascript
function mapDispatchToProps(dispatch) { return { onChangeArr: (arr) => dispatch(changeArr(arr)), onChangeFoo: (foo) => dispatch(changeFoo(foo)), onChangeBar: (bar) => dispatch(changeBar(bar)), onChangeBaz: (baz) => dispatch(changeBaz(baz)), onChangeMany: (foo) => dispatch(changeMany({ foo })), }...
[ "function", "mapDispatchToProps", "(", "dispatch", ")", "{", "return", "{", "onChangeArr", ":", "(", "arr", ")", "=>", "dispatch", "(", "changeArr", "(", "arr", ")", ")", ",", "onChangeFoo", ":", "(", "foo", ")", "=>", "dispatch", "(", "changeFoo", "(", ...
Standard react-redux mapDispatchToProps
[ "Standard", "react", "-", "redux", "mapDispatchToProps" ]
14dde6c9e7f374cc92e13a4ed70a7462d250d073
https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/examples/redux-with-actions/src/MainPage.js#L37-L45
train
pbeshai/react-url-query
examples/basic-mapUrlToProps/src/MainPage.js
mapUrlToProps
function mapUrlToProps(url, props) { return { foo: decode(UrlQueryParamTypes.number, url.fooInUrl), bar: url.bar, }; }
javascript
function mapUrlToProps(url, props) { return { foo: decode(UrlQueryParamTypes.number, url.fooInUrl), bar: url.bar, }; }
[ "function", "mapUrlToProps", "(", "url", ",", "props", ")", "{", "return", "{", "foo", ":", "decode", "(", "UrlQueryParamTypes", ".", "number", ",", "url", ".", "fooInUrl", ")", ",", "bar", ":", "url", ".", "bar", ",", "}", ";", "}" ]
Map from url query params to props. The values in `url` will still be encoded as strings since we did not pass a `urlPropsQueryConfig` to addUrlProps.
[ "Map", "from", "url", "query", "params", "to", "props", ".", "The", "values", "in", "url", "will", "still", "be", "encoded", "as", "strings", "since", "we", "did", "not", "pass", "a", "urlPropsQueryConfig", "to", "addUrlProps", "." ]
14dde6c9e7f374cc92e13a4ed70a7462d250d073
https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/examples/basic-mapUrlToProps/src/MainPage.js#L9-L14
train
pbeshai/react-url-query
examples/basic-mapUrlToProps/src/MainPage.js
mapUrlChangeHandlersToProps
function mapUrlChangeHandlersToProps(props) { return { onChangeFoo: (value) => replaceInUrlQuery('fooInUrl', encode(UrlQueryParamTypes.number, value)), onChangeBar: (value) => replaceInUrlQuery('bar', value), } }
javascript
function mapUrlChangeHandlersToProps(props) { return { onChangeFoo: (value) => replaceInUrlQuery('fooInUrl', encode(UrlQueryParamTypes.number, value)), onChangeBar: (value) => replaceInUrlQuery('bar', value), } }
[ "function", "mapUrlChangeHandlersToProps", "(", "props", ")", "{", "return", "{", "onChangeFoo", ":", "(", "value", ")", "=>", "replaceInUrlQuery", "(", "'fooInUrl'", ",", "encode", "(", "UrlQueryParamTypes", ".", "number", ",", "value", ")", ")", ",", "onChan...
Manually specify how to deal with changes to URL query param props. We do this since we are not using a urlPropsQueryConfig.
[ "Manually", "specify", "how", "to", "deal", "with", "changes", "to", "URL", "query", "param", "props", ".", "We", "do", "this", "since", "we", "are", "not", "using", "a", "urlPropsQueryConfig", "." ]
14dde6c9e7f374cc92e13a4ed70a7462d250d073
https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/examples/basic-mapUrlToProps/src/MainPage.js#L20-L25
train
pbeshai/react-url-query
src/updateUrlQuery.js
multiUpdateInLocation
function multiUpdateInLocation(queryReplacements, location) { location = getLocation(location); // if a query is there, use it, otherwise parse the search string const currQuery = location.query || parseQueryString(location.search); const newQuery = { ...currQuery, ...queryReplacements, }; // rem...
javascript
function multiUpdateInLocation(queryReplacements, location) { location = getLocation(location); // if a query is there, use it, otherwise parse the search string const currQuery = location.query || parseQueryString(location.search); const newQuery = { ...currQuery, ...queryReplacements, }; // rem...
[ "function", "multiUpdateInLocation", "(", "queryReplacements", ",", "location", ")", "{", "location", "=", "getLocation", "(", "location", ")", ";", "// if a query is there, use it, otherwise parse the search string", "const", "currQuery", "=", "location", ".", "query", "...
Update multiple parts of the location at once
[ "Update", "multiple", "parts", "of", "the", "location", "at", "once" ]
14dde6c9e7f374cc92e13a4ed70a7462d250d073
https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/src/updateUrlQuery.js#L89-L114
train
pbeshai/react-url-query
examples/react-router-v2-and-redux/src/state/rootReducer.js
app
function app(state = {}, action) { switch (action.type) { case CHANGE_BAZ: return { ...state, baz: action.payload, }; default: return state; } }
javascript
function app(state = {}, action) { switch (action.type) { case CHANGE_BAZ: return { ...state, baz: action.payload, }; default: return state; } }
[ "function", "app", "(", "state", "=", "{", "}", ",", "action", ")", "{", "switch", "(", "action", ".", "type", ")", "{", "case", "CHANGE_BAZ", ":", "return", "{", "...", "state", ",", "baz", ":", "action", ".", "payload", ",", "}", ";", "default", ...
Simple redux reducer that handles the CHANGE_BAZ action, updating the redux store to have the new value of baz.
[ "Simple", "redux", "reducer", "that", "handles", "the", "CHANGE_BAZ", "action", "updating", "the", "redux", "store", "to", "have", "the", "new", "value", "of", "baz", "." ]
14dde6c9e7f374cc92e13a4ed70a7462d250d073
https://github.com/pbeshai/react-url-query/blob/14dde6c9e7f374cc92e13a4ed70a7462d250d073/examples/react-router-v2-and-redux/src/state/rootReducer.js#L9-L19
train
google/tracing-framework
bin/dump.js
runTool
function runTool(platform, args_, done) { var args = optimist.argv; var allzones = args['allzones']; var inputFile = args['_'][0]; if (!inputFile) { console.log('usage: dump.js [--allzones] file.wtf-trace'); done(1); return; } console.log('Dumping ' + inputFile + '...'); console.log(''); w...
javascript
function runTool(platform, args_, done) { var args = optimist.argv; var allzones = args['allzones']; var inputFile = args['_'][0]; if (!inputFile) { console.log('usage: dump.js [--allzones] file.wtf-trace'); done(1); return; } console.log('Dumping ' + inputFile + '...'); console.log(''); w...
[ "function", "runTool", "(", "platform", ",", "args_", ",", "done", ")", "{", "var", "args", "=", "optimist", ".", "argv", ";", "var", "allzones", "=", "args", "[", "'allzones'", "]", ";", "var", "inputFile", "=", "args", "[", "'_'", "]", "[", "0", ...
Dump tool. @param {!wtf.pal.IPlatform} platform Platform abstraction layer. @param {!Array.<string>} args Command line arguments. @param {function(number)} done Call to end the program with a return code.
[ "Dump", "tool", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/dump.js#L28-L49
train
google/tracing-framework
bin/dump.js
dumpDatabase
function dumpDatabase(db, allzones) { var sources = db.getSources(); for (var n = 0; n < sources.length; n++) { util.logContextInfo(sources[n].getContextInfo()); } var zones = db.getZones(); if (!zones.length) { console.log('No zones'); return 0; } var count = allzones ? zones.length : 1; ...
javascript
function dumpDatabase(db, allzones) { var sources = db.getSources(); for (var n = 0; n < sources.length; n++) { util.logContextInfo(sources[n].getContextInfo()); } var zones = db.getZones(); if (!zones.length) { console.log('No zones'); return 0; } var count = allzones ? zones.length : 1; ...
[ "function", "dumpDatabase", "(", "db", ",", "allzones", ")", "{", "var", "sources", "=", "db", ".", "getSources", "(", ")", ";", "for", "(", "var", "n", "=", "0", ";", "n", "<", "sources", ".", "length", ";", "n", "++", ")", "{", "util", ".", "...
Dump the database. @param {!wtf.db.Database} db Database. @param {!boolean} allzones Whether it's needed to dump all the zones or just the first one @return {number} Return code.
[ "Dump", "the", "database", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/dump.js#L58-L81
train
google/tracing-framework
src/wtf/app/loader.js
finishLoad
function finishLoad() { // Pick a title, unless one was specified. var title = opt_title || this.generateTitleFromEntries_(entries); this.mainDisplay_.setTitle(title); // Show the document. var documentView = this.mainDisplay_.openDocument(doc); goog.asserts.assert(documentView); // Zoom t...
javascript
function finishLoad() { // Pick a title, unless one was specified. var title = opt_title || this.generateTitleFromEntries_(entries); this.mainDisplay_.setTitle(title); // Show the document. var documentView = this.mainDisplay_.openDocument(doc); goog.asserts.assert(documentView); // Zoom t...
[ "function", "finishLoad", "(", ")", "{", "// Pick a title, unless one was specified.", "var", "title", "=", "opt_title", "||", "this", ".", "generateTitleFromEntries_", "(", "entries", ")", ";", "this", ".", "mainDisplay_", ".", "setTitle", "(", "title", ")", ";",...
This is called after the dialog has closed to give it a chance to animate out.
[ "This", "is", "called", "after", "the", "dialog", "has", "closed", "to", "give", "it", "a", "chance", "to", "animate", "out", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/app/loader.js#L428-L442
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
acquireMemoryObserver
function acquireMemoryObserver() { // Only enable on first use. ++memoryObservationCount; if (memoryObservationCount > 1) { return; } // Enable memory notification. setTemporaryPreference('javascript.options.mem.notify', true); // Listen for events. Services.obs.addObserver( handleMemoryEven...
javascript
function acquireMemoryObserver() { // Only enable on first use. ++memoryObservationCount; if (memoryObservationCount > 1) { return; } // Enable memory notification. setTemporaryPreference('javascript.options.mem.notify', true); // Listen for events. Services.obs.addObserver( handleMemoryEven...
[ "function", "acquireMemoryObserver", "(", ")", "{", "// Only enable on first use.", "++", "memoryObservationCount", ";", "if", "(", "memoryObservationCount", ">", "1", ")", "{", "return", ";", "}", "// Enable memory notification.", "setTemporaryPreference", "(", "'javascr...
Acquires a reference to the memory observer, starting it if this is the first reference.
[ "Acquires", "a", "reference", "to", "the", "memory", "observer", "starting", "it", "if", "this", "is", "the", "first", "reference", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L148-L161
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
releaseMemoryObserver
function releaseMemoryObserver() { // Only disable on last use. if (!memoryObservationCount) { return; } --memoryObservationCount; if (memoryObservationCount) { return; } // Unlisten for events. Services.obs.removeObserver( handleMemoryEvent, 'garbage-collection-statistics', false); //...
javascript
function releaseMemoryObserver() { // Only disable on last use. if (!memoryObservationCount) { return; } --memoryObservationCount; if (memoryObservationCount) { return; } // Unlisten for events. Services.obs.removeObserver( handleMemoryEvent, 'garbage-collection-statistics', false); //...
[ "function", "releaseMemoryObserver", "(", ")", "{", "// Only disable on last use.", "if", "(", "!", "memoryObservationCount", ")", "{", "return", ";", "}", "--", "memoryObservationCount", ";", "if", "(", "memoryObservationCount", ")", "{", "return", ";", "}", "// ...
Releases a reference to the memory observer, stopping it if this was the last reference.
[ "Releases", "a", "reference", "to", "the", "memory", "observer", "stopping", "it", "if", "this", "was", "the", "last", "reference", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L168-L184
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
getCanonicalUrl
function getCanonicalUrl(url) { // Trim the #fragment. We are unique to query string, though. var hashIndex = url.indexOf('#'); if (hashIndex != -1) { url = url.substring(0, hashIndex); } return url; }
javascript
function getCanonicalUrl(url) { // Trim the #fragment. We are unique to query string, though. var hashIndex = url.indexOf('#'); if (hashIndex != -1) { url = url.substring(0, hashIndex); } return url; }
[ "function", "getCanonicalUrl", "(", "url", ")", "{", "// Trim the #fragment. We are unique to query string, though.", "var", "hashIndex", "=", "url", ".", "indexOf", "(", "'#'", ")", ";", "if", "(", "hashIndex", "!=", "-", "1", ")", "{", "url", "=", "url", "."...
Canonicalizes a URL so that it can be matched against. @param {string} url URL. @return {string} Canonical URL.
[ "Canonicalizes", "a", "URL", "so", "that", "it", "can", "be", "matched", "against", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L199-L206
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
function(url, worker) { /** * Page URL. * @type {string} */ this.url = url; /** * Firefox tab handle. * @type {!Tab} */ this.tab = worker.tab; /** * Page worker running the content script. * @type {!Worker} */ this.worker = worker; /** * Pending debugger records. * Thes...
javascript
function(url, worker) { /** * Page URL. * @type {string} */ this.url = url; /** * Firefox tab handle. * @type {!Tab} */ this.tab = worker.tab; /** * Page worker running the content script. * @type {!Worker} */ this.worker = worker; /** * Pending debugger records. * Thes...
[ "function", "(", "url", ",", "worker", ")", "{", "/**\n * Page URL.\n * @type {string}\n */", "this", ".", "url", "=", "url", ";", "/**\n * Firefox tab handle.\n * @type {!Tab}\n */", "this", ".", "tab", "=", "worker", ".", "tab", ";", "/**\n * Page worker...
Injected tab wrapper. @param {string} url Canonical page URL. @param {!Worker} worker Content script worker. @constructor
[ "Injected", "tab", "wrapper", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L253-L298
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
enableInjectionForUrl
function enableInjectionForUrl(url) { var url = getCanonicalUrl(url); if (activePageMods[url]) { return; } // Enable injection. setPagePreference(url, 'enabled', true); // Grab current options. Note that if they change we need to re-enable // injection to update the pagemod. var pagePrefs = getPag...
javascript
function enableInjectionForUrl(url) { var url = getCanonicalUrl(url); if (activePageMods[url]) { return; } // Enable injection. setPagePreference(url, 'enabled', true); // Grab current options. Note that if they change we need to re-enable // injection to update the pagemod. var pagePrefs = getPag...
[ "function", "enableInjectionForUrl", "(", "url", ")", "{", "var", "url", "=", "getCanonicalUrl", "(", "url", ")", ";", "if", "(", "activePageMods", "[", "url", "]", ")", "{", "return", ";", "}", "// Enable injection.", "setPagePreference", "(", "url", ",", ...
Enables injection for a URL and reloads tabs with that URL. @param {string} url URL to activate on.
[ "Enables", "injection", "for", "a", "URL", "and", "reloads", "tabs", "with", "that", "URL", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L362-L457
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
disableInjectionForUrl
function disableInjectionForUrl(url, opt_skipReload) { var url = getCanonicalUrl(url); // Disable injection. setPagePreference(url, 'enabled', false); // Find existing page mod and disable. // This will detach workers in those tabs. var mod = activePageMods[url]; if (!mod) { return; } mod.destro...
javascript
function disableInjectionForUrl(url, opt_skipReload) { var url = getCanonicalUrl(url); // Disable injection. setPagePreference(url, 'enabled', false); // Find existing page mod and disable. // This will detach workers in those tabs. var mod = activePageMods[url]; if (!mod) { return; } mod.destro...
[ "function", "disableInjectionForUrl", "(", "url", ",", "opt_skipReload", ")", "{", "var", "url", "=", "getCanonicalUrl", "(", "url", ")", ";", "// Disable injection.", "setPagePreference", "(", "url", ",", "'enabled'", ",", "false", ")", ";", "// Find existing pag...
Disables injection for a URL and reloads tabs with that URL. @param {string} url URL to activate on. @param {boolean=} opt_skipReload Whether to skip reloading of pages.
[ "Disables", "injection", "for", "a", "URL", "and", "reloads", "tabs", "with", "that", "URL", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L465-L484
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
toggleInjectionForActiveTab
function toggleInjectionForActiveTab() { var url = tabs.activeTab.url; if (!isInjectionEnabledForUrl(url)) { enableInjectionForUrl(url); } else { disableInjectionForUrl(url); } }
javascript
function toggleInjectionForActiveTab() { var url = tabs.activeTab.url; if (!isInjectionEnabledForUrl(url)) { enableInjectionForUrl(url); } else { disableInjectionForUrl(url); } }
[ "function", "toggleInjectionForActiveTab", "(", ")", "{", "var", "url", "=", "tabs", ".", "activeTab", ".", "url", ";", "if", "(", "!", "isInjectionEnabledForUrl", "(", "url", ")", ")", "{", "enableInjectionForUrl", "(", "url", ")", ";", "}", "else", "{", ...
Toggles injection for the currently active tab URL.
[ "Toggles", "injection", "for", "the", "currently", "active", "tab", "URL", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L490-L497
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
resetOptionsForActiveTab
function resetOptionsForActiveTab() { var url = getCanonicalUrl(tabs.activeTab.url); setPagePreference(url, 'options', ''); if (isInjectionEnabledForUrl(url)) { disableInjectionForUrl(url, true); enableInjectionForUrl(url); } }
javascript
function resetOptionsForActiveTab() { var url = getCanonicalUrl(tabs.activeTab.url); setPagePreference(url, 'options', ''); if (isInjectionEnabledForUrl(url)) { disableInjectionForUrl(url, true); enableInjectionForUrl(url); } }
[ "function", "resetOptionsForActiveTab", "(", ")", "{", "var", "url", "=", "getCanonicalUrl", "(", "tabs", ".", "activeTab", ".", "url", ")", ";", "setPagePreference", "(", "url", ",", "'options'", ",", "''", ")", ";", "if", "(", "isInjectionEnabledForUrl", "...
Resets WTF options for the currently active tab URL.
[ "Resets", "WTF", "options", "for", "the", "currently", "active", "tab", "URL", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L503-L510
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
setupContextMenu
function setupContextMenu() { var enableContextMenuItem = contextMenu.Item({ label: 'Enable For This URL', data: 'toggle', contentScript: "self.on('context', function(node) {" + " var hasWtf = !!document.querySelector('.wtf_a');" + " return !hasWtf ? 'Enable For This URL' : 'Disa...
javascript
function setupContextMenu() { var enableContextMenuItem = contextMenu.Item({ label: 'Enable For This URL', data: 'toggle', contentScript: "self.on('context', function(node) {" + " var hasWtf = !!document.querySelector('.wtf_a');" + " return !hasWtf ? 'Enable For This URL' : 'Disa...
[ "function", "setupContextMenu", "(", ")", "{", "var", "enableContextMenuItem", "=", "contextMenu", ".", "Item", "(", "{", "label", ":", "'Enable For This URL'", ",", "data", ":", "'toggle'", ",", "contentScript", ":", "\"self.on('context', function(node) {\"", "+", ...
Sets up the page context menu.
[ "Sets", "up", "the", "page", "context", "menu", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L525-L569
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
setupAddonBarWidget
function setupAddonBarWidget() { var panel = panels.Panel({ width: 200, height: 128, contentURL: self.data.url('widget-panel.html'), contentScriptFile: self.data.url('widget-panel.js') }); panel.on('show', function() { var url = getCanonicalUrl(tabs.activeTab.url); if (!url.length) { ...
javascript
function setupAddonBarWidget() { var panel = panels.Panel({ width: 200, height: 128, contentURL: self.data.url('widget-panel.html'), contentScriptFile: self.data.url('widget-panel.js') }); panel.on('show', function() { var url = getCanonicalUrl(tabs.activeTab.url); if (!url.length) { ...
[ "function", "setupAddonBarWidget", "(", ")", "{", "var", "panel", "=", "panels", ".", "Panel", "(", "{", "width", ":", "200", ",", "height", ":", "128", ",", "contentURL", ":", "self", ".", "data", ".", "url", "(", "'widget-panel.html'", ")", ",", "con...
Sets up the addon bar widget.
[ "Sets", "up", "the", "addon", "bar", "widget", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L575-L629
train
google/tracing-framework
extensions/wtf-injector-firefox/lib/main.js
tabChanged
function tabChanged() { var url = getCanonicalUrl(tabs.activeTab.url); widget.port.emit('update', { 'enabled': url.length ? isInjectionEnabledForUrl(url) : false }); }
javascript
function tabChanged() { var url = getCanonicalUrl(tabs.activeTab.url); widget.port.emit('update', { 'enabled': url.length ? isInjectionEnabledForUrl(url) : false }); }
[ "function", "tabChanged", "(", ")", "{", "var", "url", "=", "getCanonicalUrl", "(", "tabs", ".", "activeTab", ".", "url", ")", ";", "widget", ".", "port", ".", "emit", "(", "'update'", ",", "{", "'enabled'", ":", "url", ".", "length", "?", "isInjection...
Update the widget icon when the URL changes.
[ "Update", "the", "widget", "icon", "when", "the", "URL", "changes", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/lib/main.js#L618-L623
train
google/tracing-framework
bin/tool-runner.js
prepareDebug
function prepareDebug() { // Import Closure Library and deps.js. require('../src/wtf/bootstrap/node').importClosureLibrary([ 'wtf_js-deps.js' ]); // Disable asserts unless debugging - asserts cause all code to deopt. if (debugMode) { goog.require('goog.asserts'); goog.asserts.assert = function(co...
javascript
function prepareDebug() { // Import Closure Library and deps.js. require('../src/wtf/bootstrap/node').importClosureLibrary([ 'wtf_js-deps.js' ]); // Disable asserts unless debugging - asserts cause all code to deopt. if (debugMode) { goog.require('goog.asserts'); goog.asserts.assert = function(co...
[ "function", "prepareDebug", "(", ")", "{", "// Import Closure Library and deps.js.", "require", "(", "'../src/wtf/bootstrap/node'", ")", ".", "importClosureLibrary", "(", "[", "'wtf_js-deps.js'", "]", ")", ";", "// Disable asserts unless debugging - asserts cause all code to deop...
Prepares the global context for running a tool with the debug WTF.
[ "Prepares", "the", "global", "context", "for", "running", "a", "tool", "with", "the", "debug", "WTF", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/tool-runner.js#L32-L58
train
google/tracing-framework
bin/tool-runner.js
prepareRelease
function prepareRelease() { // Load WTF binary. Search a few paths. // TODO(benvanik): look in ENV? var searchPaths = [ '.', './build-out', '../build-out' ]; var modulePath = path.dirname(module.filename); var wtfPath = null; for (var n = 0; n < searchPaths.length; n++) { var searchPath = ...
javascript
function prepareRelease() { // Load WTF binary. Search a few paths. // TODO(benvanik): look in ENV? var searchPaths = [ '.', './build-out', '../build-out' ]; var modulePath = path.dirname(module.filename); var wtfPath = null; for (var n = 0; n < searchPaths.length; n++) { var searchPath = ...
[ "function", "prepareRelease", "(", ")", "{", "// Load WTF binary. Search a few paths.", "// TODO(benvanik): look in ENV?", "var", "searchPaths", "=", "[", "'.'", ",", "'./build-out'", ",", "'../build-out'", "]", ";", "var", "modulePath", "=", "path", ".", "dirname", "...
Prepares the global context for running a tool with the release WTF.
[ "Prepares", "the", "global", "context", "for", "running", "a", "tool", "with", "the", "release", "WTF", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/tool-runner.js#L64-L90
train
google/tracing-framework
src/wtf/app/addonmanager.js
createTabPanel
function createTabPanel(path, name, options, callback) { tabbar.addPanel(new wtf.app.AddonTabPanel( addon, documentView, path, name, options, callback)); }
javascript
function createTabPanel(path, name, options, callback) { tabbar.addPanel(new wtf.app.AddonTabPanel( addon, documentView, path, name, options, callback)); }
[ "function", "createTabPanel", "(", "path", ",", "name", ",", "options", ",", "callback", ")", "{", "tabbar", ".", "addPanel", "(", "new", "wtf", ".", "app", ".", "AddonTabPanel", "(", "addon", ",", "documentView", ",", "path", ",", "name", ",", "options"...
Creates a new tab panel. Part of the app addon API. @param {string} path Path used for navigation. @param {string} name Panel name. @param {Object} options Options. @param {wtf.app.AddonTabPanel.Callback} callback A callback that creates an external panel.
[ "Creates", "a", "new", "tab", "panel", ".", "Part", "of", "the", "app", "addon", "API", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/app/addonmanager.js#L183-L186
train
google/tracing-framework
extensions/wtf-injector-chrome/wtf-process.js
getFunctionName
function getFunctionName(node) { function cleanupName(name) { return name.replace(/[ \n]/g, ''); }; // Simple case of: // function foo() {} if (node.id) { return cleanupName(node.id.name); } // get foo() {}; if (node.parent.kind == 'get' || node.parent.kind == 'set') { ...
javascript
function getFunctionName(node) { function cleanupName(name) { return name.replace(/[ \n]/g, ''); }; // Simple case of: // function foo() {} if (node.id) { return cleanupName(node.id.name); } // get foo() {}; if (node.parent.kind == 'get' || node.parent.kind == 'set') { ...
[ "function", "getFunctionName", "(", "node", ")", "{", "function", "cleanupName", "(", "name", ")", "{", "return", "name", ".", "replace", "(", "/", "[ \\n]", "/", "g", ",", "''", ")", ";", "}", ";", "// Simple case of:", "// function foo() {}", "if", "(", ...
Attempt to guess the names of functions.
[ "Attempt", "to", "guess", "the", "names", "of", "functions", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/wtf-process.js#L57-L129
train
google/tracing-framework
extensions/wtf-injector-chrome/popup.js
setupAddBox
function setupAddBox() { var addBox = document.querySelector('.addRow input'); addBox.oninput = function() { if (addBox.value == '') { clearError(); return; } fetchAddonManifest(addBox.value); }; function fetchAddonManifest(url) { var xhr = new XMLHttpRequest(); xhr.open('GET', u...
javascript
function setupAddBox() { var addBox = document.querySelector('.addRow input'); addBox.oninput = function() { if (addBox.value == '') { clearError(); return; } fetchAddonManifest(addBox.value); }; function fetchAddonManifest(url) { var xhr = new XMLHttpRequest(); xhr.open('GET', u...
[ "function", "setupAddBox", "(", ")", "{", "var", "addBox", "=", "document", ".", "querySelector", "(", "'.addRow input'", ")", ";", "addBox", ".", "oninput", "=", "function", "(", ")", "{", "if", "(", "addBox", ".", "value", "==", "''", ")", "{", "clea...
Sets up the add addons box.
[ "Sets", "up", "the", "add", "addons", "box", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/popup.js#L62-L126
train
google/tracing-framework
extensions/wtf-injector-chrome/popup.js
updateWithInfo
function updateWithInfo(info) { var disableOverlay = document.querySelector('.disableOverlay'); var stopRecordingButton = document.querySelector('.buttonStopRecording'); var status = info.status; switch (status) { case 'instrumented': // Instrumentation is enabled for the page. disableOverlay.s...
javascript
function updateWithInfo(info) { var disableOverlay = document.querySelector('.disableOverlay'); var stopRecordingButton = document.querySelector('.buttonStopRecording'); var status = info.status; switch (status) { case 'instrumented': // Instrumentation is enabled for the page. disableOverlay.s...
[ "function", "updateWithInfo", "(", "info", ")", "{", "var", "disableOverlay", "=", "document", ".", "querySelector", "(", "'.disableOverlay'", ")", ";", "var", "stopRecordingButton", "=", "document", ".", "querySelector", "(", "'.buttonStopRecording'", ")", ";", "...
Updates the popup with the given page information. @param {!Object} info Page information.
[ "Updates", "the", "popup", "with", "the", "given", "page", "information", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/popup.js#L133-L157
train
google/tracing-framework
extensions/wtf-injector-chrome/popup.js
buildAddonTable
function buildAddonTable(addons, enabledAddons) { var tbody = document.querySelector('.addonPicker tbody'); // Remove all old content. while (tbody.firstChild) { tbody.firstChild.remove(); } // Add empty row. if (!addons.length) { var tr = document.createElement('tr'); tr.className = 'emptyRow...
javascript
function buildAddonTable(addons, enabledAddons) { var tbody = document.querySelector('.addonPicker tbody'); // Remove all old content. while (tbody.firstChild) { tbody.firstChild.remove(); } // Add empty row. if (!addons.length) { var tr = document.createElement('tr'); tr.className = 'emptyRow...
[ "function", "buildAddonTable", "(", "addons", ",", "enabledAddons", ")", "{", "var", "tbody", "=", "document", ".", "querySelector", "(", "'.addonPicker tbody'", ")", ";", "// Remove all old content.", "while", "(", "tbody", ".", "firstChild", ")", "{", "tbody", ...
Builds the addon table. @param {!Array.<!Object>} addons Addon information. @param {!Array.<string>} enabledAddons Addons that are enabled.
[ "Builds", "the", "addon", "table", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/popup.js#L165-L246
train
google/tracing-framework
extensions/wtf-injector-chrome/popup.js
openFileClicked
function openFileClicked() { var inputElement = document.createElement('input'); inputElement['type'] = 'file'; inputElement['multiple'] = true; inputElement['accept'] = [ '.wtf-trace,application/x-extension-wtf-trace', '.wtf-json,application/x-extension-wtf-json', '.wtf-calls,application/x-extensio...
javascript
function openFileClicked() { var inputElement = document.createElement('input'); inputElement['type'] = 'file'; inputElement['multiple'] = true; inputElement['accept'] = [ '.wtf-trace,application/x-extension-wtf-trace', '.wtf-json,application/x-extension-wtf-json', '.wtf-calls,application/x-extensio...
[ "function", "openFileClicked", "(", ")", "{", "var", "inputElement", "=", "document", ".", "createElement", "(", "'input'", ")", ";", "inputElement", "[", "'type'", "]", "=", "'file'", ";", "inputElement", "[", "'multiple'", "]", "=", "true", ";", "inputElem...
Shows the UI and brings up the open file dialog.
[ "Shows", "the", "UI", "and", "brings", "up", "the", "open", "file", "dialog", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/popup.js#L265-L300
train
google/tracing-framework
extensions/wtf-injector-chrome/popup.js
instrumentMemoryClicked
function instrumentMemoryClicked() { _gaq.push(['_trackEvent', 'popup', 'instrument_memory']); try { new Function('return %GetHeapUsage()'); } catch (e) { // Pop open docs page. port.postMessage({ command: 'instrument', type: 'memory', needsHelp: true }); return; } port...
javascript
function instrumentMemoryClicked() { _gaq.push(['_trackEvent', 'popup', 'instrument_memory']); try { new Function('return %GetHeapUsage()'); } catch (e) { // Pop open docs page. port.postMessage({ command: 'instrument', type: 'memory', needsHelp: true }); return; } port...
[ "function", "instrumentMemoryClicked", "(", ")", "{", "_gaq", ".", "push", "(", "[", "'_trackEvent'", ",", "'popup'", ",", "'instrument_memory'", "]", ")", ";", "try", "{", "new", "Function", "(", "'return %GetHeapUsage()'", ")", ";", "}", "catch", "(", "e",...
Toggles instrumented memory tracing.
[ "Toggles", "instrumented", "memory", "tracing", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/popup.js#L347-L367
train
google/tracing-framework
src/wtf/trace/providers/webworkerprovider.js
createInjectionShim
function createInjectionShim(scriptUrl, workerId) { // Hacky handling for blob URLs. // Unfortunately Chrome doesn't like importScript on blobs inside of the // workers, so we need to embed it. var resolvedScriptUrl = null; var scriptContents = null; if (goog.string.startsWith(scriptUrl, 'blob:'...
javascript
function createInjectionShim(scriptUrl, workerId) { // Hacky handling for blob URLs. // Unfortunately Chrome doesn't like importScript on blobs inside of the // workers, so we need to embed it. var resolvedScriptUrl = null; var scriptContents = null; if (goog.string.startsWith(scriptUrl, 'blob:'...
[ "function", "createInjectionShim", "(", "scriptUrl", ",", "workerId", ")", "{", "// Hacky handling for blob URLs.", "// Unfortunately Chrome doesn't like importScript on blobs inside of the", "// workers, so we need to embed it.", "var", "resolvedScriptUrl", "=", "null", ";", "var", ...
Creates a shim script that injects WTF. @param {string} scriptUrl Source script URL. @param {number} workerId Unique worker ID. @return {string} Shim script URL.
[ "Creates", "a", "shim", "script", "that", "injects", "WTF", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webworkerprovider.js#L276-L314
train
google/tracing-framework
src/wtf/trace/providers/webworkerprovider.js
function(scriptUrl) { goog.base(this, descriptor); /** * Tracking ID. * @type {number} * @private */ this.workerId_ = nextWorkerId++; // Create the child worker. // If we are injecting generate a shim script and use that. var newScriptUrl = scriptUrl; if (injecting) { ...
javascript
function(scriptUrl) { goog.base(this, descriptor); /** * Tracking ID. * @type {number} * @private */ this.workerId_ = nextWorkerId++; // Create the child worker. // If we are injecting generate a shim script and use that. var newScriptUrl = scriptUrl; if (injecting) { ...
[ "function", "(", "scriptUrl", ")", "{", "goog", ".", "base", "(", "this", ",", "descriptor", ")", ";", "/**\n * Tracking ID.\n * @type {number}\n * @private\n */", "this", ".", "workerId_", "=", "nextWorkerId", "++", ";", "// Create the child worker.", "...
Worker shim. @param {string} scriptUrl Script URL. @constructor @extends {wtf.trace.eventtarget.BaseEventTarget}
[ "Worker", "shim", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webworkerprovider.js#L322-L396
train
google/tracing-framework
src/wtf/trace/providers/webworkerprovider.js
sendMessage
function sendMessage(command, opt_value, opt_transfer) { // TODO(benvanik): attempt to use webkitPostMessage originalPostMessage.call(goog.global, { '__wtf_worker_msg__': true, 'command': command, 'value': opt_value || null }, []); }
javascript
function sendMessage(command, opt_value, opt_transfer) { // TODO(benvanik): attempt to use webkitPostMessage originalPostMessage.call(goog.global, { '__wtf_worker_msg__': true, 'command': command, 'value': opt_value || null }, []); }
[ "function", "sendMessage", "(", "command", ",", "opt_value", ",", "opt_transfer", ")", "{", "// TODO(benvanik): attempt to use webkitPostMessage", "originalPostMessage", ".", "call", "(", "goog", ".", "global", ",", "{", "'__wtf_worker_msg__'", ":", "true", ",", "'com...
Sends an internal message to the worker. @param {string} command Command name. @param {*=} opt_value Command value. @param {Array=} opt_transfer Transferrable values.
[ "Sends", "an", "internal", "message", "to", "the", "worker", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webworkerprovider.js#L641-L648
train
google/tracing-framework
bin/diff.js
runTool
function runTool(platform, args, done) { var inputFile1 = args[0]; var inputFile2 = args[1]; var filterString = args[2]; if (!inputFile1 || !inputFile2) { console.log('usage: diff.js file1.wtf-trace file2.wtf-trace [filter]'); done(1); return; } console.log('Diffing ' + inputFile1 + ' and ' + in...
javascript
function runTool(platform, args, done) { var inputFile1 = args[0]; var inputFile2 = args[1]; var filterString = args[2]; if (!inputFile1 || !inputFile2) { console.log('usage: diff.js file1.wtf-trace file2.wtf-trace [filter]'); done(1); return; } console.log('Diffing ' + inputFile1 + ' and ' + in...
[ "function", "runTool", "(", "platform", ",", "args", ",", "done", ")", "{", "var", "inputFile1", "=", "args", "[", "0", "]", ";", "var", "inputFile2", "=", "args", "[", "1", "]", ";", "var", "filterString", "=", "args", "[", "2", "]", ";", "if", ...
Diff tool. @param {!wtf.pal.IPlatform} platform Platform abstraction layer. @param {!Array.<string>} args Command line arguments. @param {function(number)} done Call to end the program with a return code.
[ "Diff", "tool", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/diff.js#L26-L72
train
google/tracing-framework
third_party/d3/sankey.js
computeNodeLinks
function computeNodeLinks() { nodes.forEach(function(node) { node.sourceLinks = []; node.targetLinks = []; }); links.forEach(function(link) { var source = link.source, target = link.target; if (typeof source === "number") source = link.source = nodes[link.source]; if ...
javascript
function computeNodeLinks() { nodes.forEach(function(node) { node.sourceLinks = []; node.targetLinks = []; }); links.forEach(function(link) { var source = link.source, target = link.target; if (typeof source === "number") source = link.source = nodes[link.source]; if ...
[ "function", "computeNodeLinks", "(", ")", "{", "nodes", ".", "forEach", "(", "function", "(", "node", ")", "{", "node", ".", "sourceLinks", "=", "[", "]", ";", "node", ".", "targetLinks", "=", "[", "]", ";", "}", ")", ";", "links", ".", "forEach", ...
Populate the sourceLinks and targetLinks for each node. Also, if the source and target are not objects, assume they are indices.
[ "Populate", "the", "sourceLinks", "and", "targetLinks", "for", "each", "node", ".", "Also", "if", "the", "source", "and", "target", "are", "not", "objects", "assume", "they", "are", "indices", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/third_party/d3/sankey.js#L82-L95
train
google/tracing-framework
extensions/wtf-injector-firefox/data/content-script.js
injectScriptFunction
function injectScriptFunction(fn, opt_args) { // Format args as strings that can go in the source. var args = opt_args || []; for (var n = 0; n < args.length; n++) { if (args[n] === undefined) { args[n] = 'undefined'; } else if (args[n] === null) { args[n] = 'null'; } else if (typeof args[...
javascript
function injectScriptFunction(fn, opt_args) { // Format args as strings that can go in the source. var args = opt_args || []; for (var n = 0; n < args.length; n++) { if (args[n] === undefined) { args[n] = 'undefined'; } else if (args[n] === null) { args[n] = 'null'; } else if (typeof args[...
[ "function", "injectScriptFunction", "(", "fn", ",", "opt_args", ")", "{", "// Format args as strings that can go in the source.", "var", "args", "=", "opt_args", "||", "[", "]", ";", "for", "(", "var", "n", "=", "0", ";", "n", "<", "args", ".", "length", ";"...
Injects a function into the page. @param {!Function} fn Function to inject. @param {Array=} opt_args Arguments array. All must be string serializable.
[ "Injects", "a", "function", "into", "the", "page", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/data/content-script.js#L48-L78
train
google/tracing-framework
extensions/wtf-injector-firefox/data/content-script.js
injectScriptFile
function injectScriptFile(url, rawText) { var filename = url; var lastSlash = url.lastIndexOf('/'); if (lastSlash != -1) { filename = url.substr(lastSlash + 1); } var source = [ '(function() {' + rawText + '})();', '// Web Tracing Framework injected file: ' + url, '//# sourceURL=x://wtf-injec...
javascript
function injectScriptFile(url, rawText) { var filename = url; var lastSlash = url.lastIndexOf('/'); if (lastSlash != -1) { filename = url.substr(lastSlash + 1); } var source = [ '(function() {' + rawText + '})();', '// Web Tracing Framework injected file: ' + url, '//# sourceURL=x://wtf-injec...
[ "function", "injectScriptFile", "(", "url", ",", "rawText", ")", "{", "var", "filename", "=", "url", ";", "var", "lastSlash", "=", "url", ".", "lastIndexOf", "(", "'/'", ")", ";", "if", "(", "lastSlash", "!=", "-", "1", ")", "{", "filename", "=", "ur...
Injects a script file into the page. @param {string} url Script URL. @param {string} rawText Script raw text contents.
[ "Injects", "a", "script", "file", "into", "the", "page", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/data/content-script.js#L86-L106
train
google/tracing-framework
extensions/wtf-injector-firefox/data/content-script.js
startTracing
function startTracing(addons) { // NOTE: this code is injected by string and cannot access any closure // variables! // Register addons. for (var url in addons) { var name = addons[url]['name']; log('WTF Addon Installed: ' + name + ' (' + url + ')'); wtf.addon.registerAddon(url, addons[url]); ...
javascript
function startTracing(addons) { // NOTE: this code is injected by string and cannot access any closure // variables! // Register addons. for (var url in addons) { var name = addons[url]['name']; log('WTF Addon Installed: ' + name + ' (' + url + ')'); wtf.addon.registerAddon(url, addons[url]); ...
[ "function", "startTracing", "(", "addons", ")", "{", "// NOTE: this code is injected by string and cannot access any closure", "// variables!", "// Register addons.", "for", "(", "var", "url", "in", "addons", ")", "{", "var", "name", "=", "addons", "[", "url", "]", ...
In-page trace preparation function. This is directly inserted into the page and should run immediately after the library has been loaded. This function is stringified and passed to the page, so expect no closure variables and all arguments must be serializable. @param {!Object.<!Object>} addons A map of URL to addon ...
[ "In", "-", "page", "trace", "preparation", "function", ".", "This", "is", "directly", "inserted", "into", "the", "page", "and", "should", "run", "immediately", "after", "the", "library", "has", "been", "loaded", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-firefox/data/content-script.js#L165-L180
train
google/tracing-framework
src/wtf/trace/providers/xhrprovider.js
XMLHttpRequest
function XMLHttpRequest() { var scope = ctorEvent(); goog.base(this, descriptor); /** * Real XHR. * @type {!XMLHttpRequest} * @private */ this.handle_ = new originalXhr(); /** * Event type trackers, by name. * @type {!Object.<Function>} * @private */ thi...
javascript
function XMLHttpRequest() { var scope = ctorEvent(); goog.base(this, descriptor); /** * Real XHR. * @type {!XMLHttpRequest} * @private */ this.handle_ = new originalXhr(); /** * Event type trackers, by name. * @type {!Object.<Function>} * @private */ thi...
[ "function", "XMLHttpRequest", "(", ")", "{", "var", "scope", "=", "ctorEvent", "(", ")", ";", "goog", ".", "base", "(", "this", ",", "descriptor", ")", ";", "/**\n * Real XHR.\n * @type {!XMLHttpRequest}\n * @private\n */", "this", ".", "handle_", "=...
Proxy XHR. @constructor @extends {wtf.trace.eventtarget.BaseEventTarget}
[ "Proxy", "XHR", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/xhrprovider.js#L103-L193
train
google/tracing-framework
src/wtf/trace/providers/xhrprovider.js
setupProxyProperty
function setupProxyProperty(name, opt_setPropsValue) { Object.defineProperty(ProxyXMLHttpRequest.prototype, name, { 'configurable': true, 'enumerable': true, 'get': function() { return this.handle_[name]; }, 'set': opt_setPropsValue ? function(value) { this.props_[name]...
javascript
function setupProxyProperty(name, opt_setPropsValue) { Object.defineProperty(ProxyXMLHttpRequest.prototype, name, { 'configurable': true, 'enumerable': true, 'get': function() { return this.handle_[name]; }, 'set': opt_setPropsValue ? function(value) { this.props_[name]...
[ "function", "setupProxyProperty", "(", "name", ",", "opt_setPropsValue", ")", "{", "Object", ".", "defineProperty", "(", "ProxyXMLHttpRequest", ".", "prototype", ",", "name", ",", "{", "'configurable'", ":", "true", ",", "'enumerable'", ":", "true", ",", "'get'"...
Sets up a proxy property, optionally setting a props bag value. @param {string} name Property name. @param {boolean=} opt_setPropsValue True to set a props value of the same name with the given value.
[ "Sets", "up", "a", "proxy", "property", "optionally", "setting", "a", "props", "bag", "value", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/xhrprovider.js#L251-L265
train
google/tracing-framework
extensions/wtf-injector-chrome/wtf-call-tracing.js
function(baseUrl, url) { if (!resolveCache) { var iframe = document.createElement('iframe'); document.documentElement.appendChild(iframe); var doc = iframe.contentWindow.document; var base = doc.createElement('base'); doc.documentElement.appendChild(base); var a = doc.createElement('a'); d...
javascript
function(baseUrl, url) { if (!resolveCache) { var iframe = document.createElement('iframe'); document.documentElement.appendChild(iframe); var doc = iframe.contentWindow.document; var base = doc.createElement('base'); doc.documentElement.appendChild(base); var a = doc.createElement('a'); d...
[ "function", "(", "baseUrl", ",", "url", ")", "{", "if", "(", "!", "resolveCache", ")", "{", "var", "iframe", "=", "document", ".", "createElement", "(", "'iframe'", ")", ";", "document", ".", "documentElement", ".", "appendChild", "(", "iframe", ")", ";"...
Resolves a URL to an absolute path. @param {string} baseUrl Base URL. @param {string} url Target URL.
[ "Resolves", "a", "URL", "to", "an", "absolute", "path", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/wtf-call-tracing.js#L88-L107
train
google/tracing-framework
src/wtf/trace/providers/websocketprovider.js
WebSocket
function WebSocket(url, opt_protocols) { var scope = ctorEvent(); goog.base(this, descriptor); /** * Underlying WS. * @type {!WebSocket} * @private */ this.handle_ = arguments.length == 1 ? new originalWs(url) : new originalWs(url, opt_protocols); /** * Eve...
javascript
function WebSocket(url, opt_protocols) { var scope = ctorEvent(); goog.base(this, descriptor); /** * Underlying WS. * @type {!WebSocket} * @private */ this.handle_ = arguments.length == 1 ? new originalWs(url) : new originalWs(url, opt_protocols); /** * Eve...
[ "function", "WebSocket", "(", "url", ",", "opt_protocols", ")", "{", "var", "scope", "=", "ctorEvent", "(", ")", ";", "goog", ".", "base", "(", "this", ",", "descriptor", ")", ";", "/**\n * Underlying WS.\n * @type {!WebSocket}\n * @private\n */", "t...
Proxy WebSocket. @constructor @param {string} url Destination URL. @param {string=} opt_protocols Optional protocol. @extends {wtf.trace.eventtarget.BaseEventTarget}
[ "Proxy", "WebSocket", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/websocketprovider.js#L99-L130
train
google/tracing-framework
extensions/wtf-injector-chrome/options.js
function() { /** * Whether to show the page-action 'inject' icon. * @type {boolean} */ this.showPageAction = true; /** * Whether to show the context menu items. * @type {boolean} */ this.showContextMenu = false; /** * Whether to show the devtools panel. * @type {boolean} */ this...
javascript
function() { /** * Whether to show the page-action 'inject' icon. * @type {boolean} */ this.showPageAction = true; /** * Whether to show the context menu items. * @type {boolean} */ this.showContextMenu = false; /** * Whether to show the devtools panel. * @type {boolean} */ this...
[ "function", "(", ")", "{", "/**\n * Whether to show the page-action 'inject' icon.\n * @type {boolean}\n */", "this", ".", "showPageAction", "=", "true", ";", "/**\n * Whether to show the context menu items.\n * @type {boolean}\n */", "this", ".", "showContextMenu", "=", ...
Options wrapper. Saves settings with the Chrome settings store. Settings are saved as a big blob to enable syncrhonous access to values. @constructor
[ "Options", "wrapper", ".", "Saves", "settings", "with", "the", "Chrome", "settings", "store", ".", "Settings", "are", "saved", "as", "a", "big", "blob", "to", "enable", "syncrhonous", "access", "to", "values", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/options.js#L34-L99
train
google/tracing-framework
bin/query.js
runTool
function runTool(platform, args, done) { if (args.length < 1) { console.log('usage: query.js file.wtf-trace "[query string]"'); done(1); return; } var inputFile = args[0]; var exprArgs = args.slice(1); var expr = exprArgs.join(' ').trim(); console.log('Querying ' + inputFile + '...'); // Cr...
javascript
function runTool(platform, args, done) { if (args.length < 1) { console.log('usage: query.js file.wtf-trace "[query string]"'); done(1); return; } var inputFile = args[0]; var exprArgs = args.slice(1); var expr = exprArgs.join(' ').trim(); console.log('Querying ' + inputFile + '...'); // Cr...
[ "function", "runTool", "(", "platform", ",", "args", ",", "done", ")", "{", "if", "(", "args", ".", "length", "<", "1", ")", "{", "console", ".", "log", "(", "'usage: query.js file.wtf-trace \"[query string]\"'", ")", ";", "done", "(", "1", ")", ";", "re...
Query tool. @param {!wtf.pal.IPlatform} platform Platform abstraction layer. @param {!Array.<string>} args Command line arguments. @param {function(number)} done Call to end the program with a return code.
[ "Query", "tool", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/query.js#L29-L59
train
google/tracing-framework
bin/query.js
queryDatabase
function queryDatabase(db, expr) { // TODO(benvanik): allow the user to switch zone. var zone = db.getZones()[0]; // If the user provided an expression on the command line, use that. if (expr && expr.length) { issue(expr); return 0; } var rl = readline.createInterface({ input: process.stdin, ...
javascript
function queryDatabase(db, expr) { // TODO(benvanik): allow the user to switch zone. var zone = db.getZones()[0]; // If the user provided an expression on the command line, use that. if (expr && expr.length) { issue(expr); return 0; } var rl = readline.createInterface({ input: process.stdin, ...
[ "function", "queryDatabase", "(", "db", ",", "expr", ")", "{", "// TODO(benvanik): allow the user to switch zone.", "var", "zone", "=", "db", ".", "getZones", "(", ")", "[", "0", "]", ";", "// If the user provided an expression on the command line, use that.", "if", "("...
Runs a REPL that queries a database. @param {!wtf.db.Database} db Database. @param {string} expr Query string.
[ "Runs", "a", "REPL", "that", "queries", "a", "database", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/query.js#L67-L147
train
google/tracing-framework
bin/save-trace.js
handlePost
function handlePost(req, res) { var length = parseInt(req.headers['content-length'], 10); if (length <= 0) { res.end(); return; } var filename = req.headers['x-filename'] || 'save-trace.wtf-trace'; var writable = fs.createWriteStream(filename, {flags: 'w'}); req.on('data', function(chunk) { wr...
javascript
function handlePost(req, res) { var length = parseInt(req.headers['content-length'], 10); if (length <= 0) { res.end(); return; } var filename = req.headers['x-filename'] || 'save-trace.wtf-trace'; var writable = fs.createWriteStream(filename, {flags: 'w'}); req.on('data', function(chunk) { wr...
[ "function", "handlePost", "(", "req", ",", "res", ")", "{", "var", "length", "=", "parseInt", "(", "req", ".", "headers", "[", "'content-length'", "]", ",", "10", ")", ";", "if", "(", "length", "<=", "0", ")", "{", "res", ".", "end", "(", ")", ";...
Save the posted trace file to local directory.
[ "Save", "the", "posted", "trace", "file", "to", "local", "directory", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/save-trace.js#L33-L52
train
google/tracing-framework
bin/save-trace.js
handleOptions
function handleOptions(req, res) { var acrh = req.headers['access-control-request-headers']; var origin = req.headers['origin']; if (acrh) res.setHeader('Access-Control-Allow-Headers', acrh); if (origin) res.setHeader('Access-Control-Allow-Origin', origin); res.end(); }
javascript
function handleOptions(req, res) { var acrh = req.headers['access-control-request-headers']; var origin = req.headers['origin']; if (acrh) res.setHeader('Access-Control-Allow-Headers', acrh); if (origin) res.setHeader('Access-Control-Allow-Origin', origin); res.end(); }
[ "function", "handleOptions", "(", "req", ",", "res", ")", "{", "var", "acrh", "=", "req", ".", "headers", "[", "'access-control-request-headers'", "]", ";", "var", "origin", "=", "req", ".", "headers", "[", "'origin'", "]", ";", "if", "(", "acrh", ")", ...
Echo CORS headers.
[ "Echo", "CORS", "headers", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/save-trace.js#L55-L61
train
google/tracing-framework
extensions/wtf-injector-chrome/third_party/falafel.js
match
function match(value) { var token = lookahead(); return token.type === Token.Punctuator && token.value === value; }
javascript
function match(value) { var token = lookahead(); return token.type === Token.Punctuator && token.value === value; }
[ "function", "match", "(", "value", ")", "{", "var", "token", "=", "lookahead", "(", ")", ";", "return", "token", ".", "type", "===", "Token", ".", "Punctuator", "&&", "token", ".", "value", "===", "value", ";", "}" ]
Return true if the next token matches the specified punctuator.
[ "Return", "true", "if", "the", "next", "token", "matches", "the", "specified", "punctuator", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/third_party/falafel.js#L1245-L1248
train
google/tracing-framework
extensions/wtf-injector-chrome/third_party/falafel.js
matchKeyword
function matchKeyword(keyword) { var token = lookahead(); return token.type === Token.Keyword && token.value === keyword; }
javascript
function matchKeyword(keyword) { var token = lookahead(); return token.type === Token.Keyword && token.value === keyword; }
[ "function", "matchKeyword", "(", "keyword", ")", "{", "var", "token", "=", "lookahead", "(", ")", ";", "return", "token", ".", "type", "===", "Token", ".", "Keyword", "&&", "token", ".", "value", "===", "keyword", ";", "}" ]
Return true if the next token matches the specified keyword
[ "Return", "true", "if", "the", "next", "token", "matches", "the", "specified", "keyword" ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/third_party/falafel.js#L1252-L1255
train
google/tracing-framework
extensions/wtf-injector-chrome/third_party/falafel.js
parseMultiplicativeExpression
function parseMultiplicativeExpression() { var expr = parseUnaryExpression(); while (match('*') || match('/') || match('%')) { expr = { type: Syntax.BinaryExpression, operator: lex().value, left: expr, right: parseUnaryExpressi...
javascript
function parseMultiplicativeExpression() { var expr = parseUnaryExpression(); while (match('*') || match('/') || match('%')) { expr = { type: Syntax.BinaryExpression, operator: lex().value, left: expr, right: parseUnaryExpressi...
[ "function", "parseMultiplicativeExpression", "(", ")", "{", "var", "expr", "=", "parseUnaryExpression", "(", ")", ";", "while", "(", "match", "(", "'*'", ")", "||", "match", "(", "'/'", ")", "||", "match", "(", "'%'", ")", ")", "{", "expr", "=", "{", ...
11.5 Multiplicative Operators
[ "11", ".", "5", "Multiplicative", "Operators" ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/third_party/falafel.js#L1789-L1802
train
google/tracing-framework
extensions/wtf-injector-chrome/third_party/falafel.js
parseEqualityExpression
function parseEqualityExpression() { var expr = parseRelationalExpression(); while (match('==') || match('!=') || match('===') || match('!==')) { expr = { type: Syntax.BinaryExpression, operator: lex().value, left: expr, right:...
javascript
function parseEqualityExpression() { var expr = parseRelationalExpression(); while (match('==') || match('!=') || match('===') || match('!==')) { expr = { type: Syntax.BinaryExpression, operator: lex().value, left: expr, right:...
[ "function", "parseEqualityExpression", "(", ")", "{", "var", "expr", "=", "parseRelationalExpression", "(", ")", ";", "while", "(", "match", "(", "'=='", ")", "||", "match", "(", "'!='", ")", "||", "match", "(", "'==='", ")", "||", "match", "(", "'!=='",...
11.9 Equality Operators
[ "11", ".", "9", "Equality", "Operators" ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/third_party/falafel.js#L1862-L1875
train
google/tracing-framework
extensions/wtf-injector-chrome/third_party/falafel.js
parseLogicalANDExpression
function parseLogicalANDExpression() { var expr = parseBitwiseORExpression(); while (match('&&')) { lex(); expr = { type: Syntax.LogicalExpression, operator: '&&', left: expr, right: parseBitwiseORExpression() ...
javascript
function parseLogicalANDExpression() { var expr = parseBitwiseORExpression(); while (match('&&')) { lex(); expr = { type: Syntax.LogicalExpression, operator: '&&', left: expr, right: parseBitwiseORExpression() ...
[ "function", "parseLogicalANDExpression", "(", ")", "{", "var", "expr", "=", "parseBitwiseORExpression", "(", ")", ";", "while", "(", "match", "(", "'&&'", ")", ")", "{", "lex", "(", ")", ";", "expr", "=", "{", "type", ":", "Syntax", ".", "LogicalExpressi...
11.11 Binary Logical Operators
[ "11", ".", "11", "Binary", "Logical", "Operators" ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/third_party/falafel.js#L1929-L1943
train
google/tracing-framework
src/wtf/bootstrap/node.js
fileExistsSync
function fileExistsSync(path) { if (fs.existsSync) { return fs.existsSync(path); } else { try { fs.statSync(path); return true; } catch (e) { return false; } } }
javascript
function fileExistsSync(path) { if (fs.existsSync) { return fs.existsSync(path); } else { try { fs.statSync(path); return true; } catch (e) { return false; } } }
[ "function", "fileExistsSync", "(", "path", ")", "{", "if", "(", "fs", ".", "existsSync", ")", "{", "return", "fs", ".", "existsSync", "(", "path", ")", ";", "}", "else", "{", "try", "{", "fs", ".", "statSync", "(", "path", ")", ";", "return", "true...
Checks to see if a file exists. Compatibility shim for old node.js' that lack fs.existsSync. @param {string} path File path. @return {boolean} True if the file exists.
[ "Checks", "to", "see", "if", "a", "file", "exists", ".", "Compatibility", "shim", "for", "old", "node", ".", "js", "that", "lack", "fs", ".", "existsSync", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/bootstrap/node.js#L96-L107
train
google/tracing-framework
extensions/wtf-injector-chrome/debugger.js
function(tabId, pageOptions) { /** * Target tab ID. * @type {number} * @private */ this.tabId_ = tabId; /** * Target debugee. * @type {!Object} * @private */ this.debugee_ = { tabId: this.tabId_ }; /** * Page options. * @type {!Object} * @private */ this.pageOptio...
javascript
function(tabId, pageOptions) { /** * Target tab ID. * @type {number} * @private */ this.tabId_ = tabId; /** * Target debugee. * @type {!Object} * @private */ this.debugee_ = { tabId: this.tabId_ }; /** * Page options. * @type {!Object} * @private */ this.pageOptio...
[ "function", "(", "tabId", ",", "pageOptions", ")", "{", "/**\n * Target tab ID.\n * @type {number}\n * @private\n */", "this", ".", "tabId_", "=", "tabId", ";", "/**\n * Target debugee.\n * @type {!Object}\n * @private\n */", "this", ".", "debugee_", "=", "{", ...
Debugger data proxy. This connects to a tab and sets up a debug session that is used for reading out events from the page. @param {number} tabId Tab ID. @param {!Object} pageOptions Page options. @constructor
[ "Debugger", "data", "proxy", ".", "This", "connects", "to", "a", "tab", "and", "sets", "up", "a", "debug", "session", "that", "is", "used", "for", "reading", "out", "events", "from", "the", "page", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/debugger.js#L133-L202
train
google/tracing-framework
bin/generate-webgl-app.js
copyFile
function copyFile(src, dest) { var content = fs.readFileSync(src, 'binary'); fs.writeFileSync(dest, content, 'binary'); }
javascript
function copyFile(src, dest) { var content = fs.readFileSync(src, 'binary'); fs.writeFileSync(dest, content, 'binary'); }
[ "function", "copyFile", "(", "src", ",", "dest", ")", "{", "var", "content", "=", "fs", ".", "readFileSync", "(", "src", ",", "'binary'", ")", ";", "fs", ".", "writeFileSync", "(", "dest", ",", "content", ",", "'binary'", ")", ";", "}" ]
Copy DLLs to output path.
[ "Copy", "DLLs", "to", "output", "path", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/generate-webgl-app.js#L378-L381
train
google/tracing-framework
src/wtf/wtf.js
computeInner
function computeInner(iterations) { var dummy = 0; for (var n = 0; n < iterations; n++) { // We don't have to worry about this being entirely removed (yet), as // JITs don't seem to consider now() as not having side-effects. dummy += wtf.now(); } return dummy; }
javascript
function computeInner(iterations) { var dummy = 0; for (var n = 0; n < iterations; n++) { // We don't have to worry about this being entirely removed (yet), as // JITs don't seem to consider now() as not having side-effects. dummy += wtf.now(); } return dummy; }
[ "function", "computeInner", "(", "iterations", ")", "{", "var", "dummy", "=", "0", ";", "for", "(", "var", "n", "=", "0", ";", "n", "<", "iterations", ";", "n", "++", ")", "{", "// We don't have to worry about this being entirely removed (yet), as", "// JITs don...
This is in a function so that v8 can JIT it easier. We then run it a few times to try to factor out the JIT time.
[ "This", "is", "in", "a", "function", "so", "that", "v8", "can", "JIT", "it", "easier", ".", "We", "then", "run", "it", "a", "few", "times", "to", "try", "to", "factor", "out", "the", "JIT", "time", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/wtf.js#L220-L228
train
google/tracing-framework
bin/instrument.js
processFile
function processFile(argv, inputPath, opt_outputPath) { // Setup output path. var outputPath = opt_outputPath; if (!opt_outputPath) { var ext = path.extname(inputPath); if (ext.length) { outputPath = inputPath.substr(0, inputPath.length - ext.length) + '.instrumented' + ext; } else { ...
javascript
function processFile(argv, inputPath, opt_outputPath) { // Setup output path. var outputPath = opt_outputPath; if (!opt_outputPath) { var ext = path.extname(inputPath); if (ext.length) { outputPath = inputPath.substr(0, inputPath.length - ext.length) + '.instrumented' + ext; } else { ...
[ "function", "processFile", "(", "argv", ",", "inputPath", ",", "opt_outputPath", ")", "{", "// Setup output path.", "var", "outputPath", "=", "opt_outputPath", ";", "if", "(", "!", "opt_outputPath", ")", "{", "var", "ext", "=", "path", ".", "extname", "(", "...
Processes a single input file. @param {!Object} argv Parsed arguments. @param {string} inputPath Input file path. @param {string=} opt_outputPath Output file path.
[ "Processes", "a", "single", "input", "file", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/instrument.js#L333-L354
train
google/tracing-framework
bin/instrument.js
handler
function handler(req, res) { // Support both the ?url= mode and the X-WTF-URL header. var targetUrl; if (req.headers['x-wtf-url']) { targetUrl = req.headers['x-wtf-url']; } else { var parsedUrl = url.parse(req.url, true); var query = parsedUrl.query; targetUrl = query.url; } ...
javascript
function handler(req, res) { // Support both the ?url= mode and the X-WTF-URL header. var targetUrl; if (req.headers['x-wtf-url']) { targetUrl = req.headers['x-wtf-url']; } else { var parsedUrl = url.parse(req.url, true); var query = parsedUrl.query; targetUrl = query.url; } ...
[ "function", "handler", "(", "req", ",", "res", ")", "{", "// Support both the ?url= mode and the X-WTF-URL header.", "var", "targetUrl", ";", "if", "(", "req", ".", "headers", "[", "'x-wtf-url'", "]", ")", "{", "targetUrl", "=", "req", ".", "headers", "[", "'x...
Handles both HTTP and HTTPS requests.
[ "Handles", "both", "HTTP", "and", "HTTPS", "requests", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/bin/instrument.js#L395-L463
train
google/tracing-framework
extensions/wtf-injector-chrome/wtf-injector.js
fetchOptions
function fetchOptions() { /** * Name of the cookie that contains the options for the injection. * The data is just a blob GUID that is used to construct a URL to the blob * exposed by the extension. * @const * @type {string} */ var WTF_OPTIONS_COOKIE = 'wtf'; /** * Cookie used for instrument...
javascript
function fetchOptions() { /** * Name of the cookie that contains the options for the injection. * The data is just a blob GUID that is used to construct a URL to the blob * exposed by the extension. * @const * @type {string} */ var WTF_OPTIONS_COOKIE = 'wtf'; /** * Cookie used for instrument...
[ "function", "fetchOptions", "(", ")", "{", "/**\n * Name of the cookie that contains the options for the injection.\n * The data is just a blob GUID that is used to construct a URL to the blob\n * exposed by the extension.\n * @const\n * @type {string}\n */", "var", "WTF_OPTIONS_COOKIE", ...
Fetches the options from the extension background page. This will only return a value if the options were injected in a cookie, and if no options are returned it means the injection is not active. @return {!Object} Options object.
[ "Fetches", "the", "options", "from", "the", "extension", "background", "page", ".", "This", "will", "only", "return", "a", "value", "if", "the", "options", "were", "injected", "in", "a", "cookie", "and", "if", "no", "options", "are", "returned", "it", "mea...
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/wtf-injector.js#L141-L241
train
google/tracing-framework
extensions/wtf-injector-chrome/wtf-injector.js
injectAddons
function injectAddons(manifestUrls) { var addons = {}; for (var n = 0; n < manifestUrls.length; n++) { // Fetch Manifest JSON. var url = manifestUrls[n]; var json = getUrl(url); if (!json) { log('Unable to fetch manifest JSON: ' + url); continue; } json = JSON.parse(json); ad...
javascript
function injectAddons(manifestUrls) { var addons = {}; for (var n = 0; n < manifestUrls.length; n++) { // Fetch Manifest JSON. var url = manifestUrls[n]; var json = getUrl(url); if (!json) { log('Unable to fetch manifest JSON: ' + url); continue; } json = JSON.parse(json); ad...
[ "function", "injectAddons", "(", "manifestUrls", ")", "{", "var", "addons", "=", "{", "}", ";", "for", "(", "var", "n", "=", "0", ";", "n", "<", "manifestUrls", ".", "length", ";", "n", "++", ")", "{", "// Fetch Manifest JSON.", "var", "url", "=", "m...
Injects the given addons into the page. @param {!Array.<string>} manifestUrls Addon manifest JSON URLs. @return {!Object.<!Object>} Addon manifests, mapped by manifest URL.
[ "Injects", "the", "given", "addons", "into", "the", "page", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/wtf-injector.js#L249-L276
train
google/tracing-framework
extensions/wtf-injector-chrome/wtf-injector.js
convertUint8ArraysToArrays
function convertUint8ArraysToArrays(sources) { var targets = []; for (var n = 0; n < sources.length; n++) { var source = sources[n]; var target = new Array(source.length); for (var i = 0; i < source.length; i++) { target[i] = source[i]; } targets.push(target); } return targets; }
javascript
function convertUint8ArraysToArrays(sources) { var targets = []; for (var n = 0; n < sources.length; n++) { var source = sources[n]; var target = new Array(source.length); for (var i = 0; i < source.length; i++) { target[i] = source[i]; } targets.push(target); } return targets; }
[ "function", "convertUint8ArraysToArrays", "(", "sources", ")", "{", "var", "targets", "=", "[", "]", ";", "for", "(", "var", "n", "=", "0", ";", "n", "<", "sources", ".", "length", ";", "n", "++", ")", "{", "var", "source", "=", "sources", "[", "n"...
Converts a list of Uint8Arrays to regular arrays. @param {!Array.<!Uint8Array>} sources Source arrays. @return {!Array.<!Array.<number>>} Target arrays.
[ "Converts", "a", "list", "of", "Uint8Arrays", "to", "regular", "arrays", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/wtf-injector.js#L314-L325
train
google/tracing-framework
extensions/wtf-injector-chrome/wtf-injector.js
resolveUrl
function resolveUrl(base, url) { var value = ''; if (url.indexOf('://') != -1) { // Likely absolute... value = url; } else { // Combine by smashing together and letting the browser figure it out. if (url.length && url[0] == '/') { // URL is absolute, so strip base to just host. var i =...
javascript
function resolveUrl(base, url) { var value = ''; if (url.indexOf('://') != -1) { // Likely absolute... value = url; } else { // Combine by smashing together and letting the browser figure it out. if (url.length && url[0] == '/') { // URL is absolute, so strip base to just host. var i =...
[ "function", "resolveUrl", "(", "base", ",", "url", ")", "{", "var", "value", "=", "''", ";", "if", "(", "url", ".", "indexOf", "(", "'://'", ")", "!=", "-", "1", ")", "{", "// Likely absolute...", "value", "=", "url", ";", "}", "else", "{", "// Com...
Hackily resolves a URL relative to a base. @param {string} base Base URL. @param {string} url Relative or absolute URL. @return {string} Resolved URL.
[ "Hackily", "resolves", "a", "URL", "relative", "to", "a", "base", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/extensions/wtf-injector-chrome/wtf-injector.js#L404-L430
train
google/tracing-framework
src/wtf/trace/providers/webglprovider.js
wrapMethod
function wrapMethod(target, targetType, signature, opt_generator) { // Parse signature. var parsedSignature = wtf.data.Variable.parseSignature(signature); var methodName = parsedSignature.name; // Define a custom event type at runtime. var customEvent = wtf.trace.events.createScope( targetT...
javascript
function wrapMethod(target, targetType, signature, opt_generator) { // Parse signature. var parsedSignature = wtf.data.Variable.parseSignature(signature); var methodName = parsedSignature.name; // Define a custom event type at runtime. var customEvent = wtf.trace.events.createScope( targetT...
[ "function", "wrapMethod", "(", "target", ",", "targetType", ",", "signature", ",", "opt_generator", ")", "{", "// Parse signature.", "var", "parsedSignature", "=", "wtf", ".", "data", ".", "Variable", ".", "parseSignature", "(", "signature", ")", ";", "var", "...
Wraps a method on the target prototype with a scoped event. Optionally the method can provide a custom callback routine. @param {!Object} target Target object/prototype. @param {string} targetType Target type name. @param {string} signature Event signature. @param {Function=} opt_generator Generator function.
[ "Wraps", "a", "method", "on", "the", "target", "prototype", "with", "a", "scoped", "event", ".", "Optionally", "the", "method", "can", "provide", "a", "custom", "callback", "routine", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webglprovider.js#L368-L413
train
google/tracing-framework
src/wtf/trace/providers/webglprovider.js
wrapInstancedArraysExtension
function wrapInstancedArraysExtension(ctx, proto) { /** * @param {string} signature Event signature. * @param {Function=} opt_generator Generator function. */ function wrapInstancedArraysMethod(signature, opt_generator) { wrapMethod( proto, 'ANGLEInstancedArrays', signat...
javascript
function wrapInstancedArraysExtension(ctx, proto) { /** * @param {string} signature Event signature. * @param {Function=} opt_generator Generator function. */ function wrapInstancedArraysMethod(signature, opt_generator) { wrapMethod( proto, 'ANGLEInstancedArrays', signat...
[ "function", "wrapInstancedArraysExtension", "(", "ctx", ",", "proto", ")", "{", "/**\n * @param {string} signature Event signature.\n * @param {Function=} opt_generator Generator function.\n */", "function", "wrapInstancedArraysMethod", "(", "signature", ",", "opt_generator",...
Wraps the ANGLEInstancedArrays extension object. @param {!WebGLRenderingContext} ctx Target context. @param {!Object} proto Prototype object.
[ "Wraps", "the", "ANGLEInstancedArrays", "extension", "object", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webglprovider.js#L443-L483
train
google/tracing-framework
src/wtf/trace/providers/webglprovider.js
wrapVertexArrayObjectExtension
function wrapVertexArrayObjectExtension(ctx, proto) { /** * @param {string} signature Event signature. * @param {Function=} opt_generator Generator function. */ function wrapVertexArrayObjectMethod(signature, opt_generator) { wrapMethod( proto, 'OESVertexArrayObject', si...
javascript
function wrapVertexArrayObjectExtension(ctx, proto) { /** * @param {string} signature Event signature. * @param {Function=} opt_generator Generator function. */ function wrapVertexArrayObjectMethod(signature, opt_generator) { wrapMethod( proto, 'OESVertexArrayObject', si...
[ "function", "wrapVertexArrayObjectExtension", "(", "ctx", ",", "proto", ")", "{", "/**\n * @param {string} signature Event signature.\n * @param {Function=} opt_generator Generator function.\n */", "function", "wrapVertexArrayObjectMethod", "(", "signature", ",", "opt_generat...
Wraps the OESVertexArrayObject extension object. @param {!WebGLRenderingContext} ctx Target context. @param {!Object} proto Prototype object.
[ "Wraps", "the", "OESVertexArrayObject", "extension", "object", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webglprovider.js#L490-L544
train
google/tracing-framework
src/wtf/trace/providers/webglprovider.js
wrapLoseContextExtension
function wrapLoseContextExtension(ctx, proto) { /** * @param {string} signature Event signature. * @param {Function=} opt_generator Generator function. */ function wrapLoseContextMethod(signature, opt_generator) { wrapMethod( proto, 'WebGLLoseContext', signature, opt_gen...
javascript
function wrapLoseContextExtension(ctx, proto) { /** * @param {string} signature Event signature. * @param {Function=} opt_generator Generator function. */ function wrapLoseContextMethod(signature, opt_generator) { wrapMethod( proto, 'WebGLLoseContext', signature, opt_gen...
[ "function", "wrapLoseContextExtension", "(", "ctx", ",", "proto", ")", "{", "/**\n * @param {string} signature Event signature.\n * @param {Function=} opt_generator Generator function.\n */", "function", "wrapLoseContextMethod", "(", "signature", ",", "opt_generator", ")", ...
Wraps the WebGLLoseContext extension object. @param {!WebGLRenderingContext} ctx Target context. @param {!Object} proto Prototype object.
[ "Wraps", "the", "WebGLLoseContext", "extension", "object", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webglprovider.js#L551-L582
train
google/tracing-framework
src/wtf/trace/providers/webglprovider.js
instrumentExtensionObject
function instrumentExtensionObject(ctx, name, object) { var proto = object.constructor.prototype; // We do this check only for known extensions, as Firefox will return a // generic 'Object' for others and that will break everything. function checkInstrumented() { if (proto['__gl_wrapped__']) { ...
javascript
function instrumentExtensionObject(ctx, name, object) { var proto = object.constructor.prototype; // We do this check only for known extensions, as Firefox will return a // generic 'Object' for others and that will break everything. function checkInstrumented() { if (proto['__gl_wrapped__']) { ...
[ "function", "instrumentExtensionObject", "(", "ctx", ",", "name", ",", "object", ")", "{", "var", "proto", "=", "object", ".", "constructor", ".", "prototype", ";", "// We do this check only for known extensions, as Firefox will return a", "// generic 'Object' for others and ...
Wraps an extension object. This should be called for each extension object as it is returned from getExtension so that its prototype can be instrumented, as required. @param {!WebGLRenderingContext} ctx Target context. @param {string} name Extension name. @param {!Object} object Extension object. @return {boolean} True...
[ "Wraps", "an", "extension", "object", ".", "This", "should", "be", "called", "for", "each", "extension", "object", "as", "it", "is", "returned", "from", "getExtension", "so", "that", "its", "prototype", "can", "be", "instrumented", "as", "required", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webglprovider.js#L593-L640
train
google/tracing-framework
src/wtf/trace/providers/webglprovider.js
checkInstrumented
function checkInstrumented() { if (proto['__gl_wrapped__']) { return false; } Object.defineProperty(proto, '__gl_wrapped__', { 'configurable': true, 'enumerable': false, 'value': true }); contextRestoreFns.push(function() { delete proto['__gl_wrapped...
javascript
function checkInstrumented() { if (proto['__gl_wrapped__']) { return false; } Object.defineProperty(proto, '__gl_wrapped__', { 'configurable': true, 'enumerable': false, 'value': true }); contextRestoreFns.push(function() { delete proto['__gl_wrapped...
[ "function", "checkInstrumented", "(", ")", "{", "if", "(", "proto", "[", "'__gl_wrapped__'", "]", ")", "{", "return", "false", ";", "}", "Object", ".", "defineProperty", "(", "proto", ",", "'__gl_wrapped__'", ",", "{", "'configurable'", ":", "true", ",", "...
We do this check only for known extensions, as Firefox will return a generic 'Object' for others and that will break everything.
[ "We", "do", "this", "check", "only", "for", "known", "extensions", "as", "Firefox", "will", "return", "a", "generic", "Object", "for", "others", "and", "that", "will", "break", "everything", "." ]
495ced98de99a5895e484b2e09771edb42d3c7ab
https://github.com/google/tracing-framework/blob/495ced98de99a5895e484b2e09771edb42d3c7ab/src/wtf/trace/providers/webglprovider.js#L598-L611
train
soyuka/pidusage
index.js
pidusage
function pidusage (pids, options, callback) { if (typeof options === 'function') { callback = options options = {} } if (options === undefined) { options = {} } if (typeof callback === 'function') { stats(pids, options, callback) return } return new Promise(function (resolve, reject...
javascript
function pidusage (pids, options, callback) { if (typeof options === 'function') { callback = options options = {} } if (options === undefined) { options = {} } if (typeof callback === 'function') { stats(pids, options, callback) return } return new Promise(function (resolve, reject...
[ "function", "pidusage", "(", "pids", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "callback", "=", "options", "options", "=", "{", "}", "}", "if", "(", "options", "===", "undefined", ")", "{"...
Get pid informations. @public @param {Number|Number[]|String|String[]} pids A pid or a list of pids. @param {Object} [options={}] Options object @param {Function} [callback=undefined] Called when the statistics are ready. If not provided a promise is returned instead. @returns {Promise.<Object>} Only when the callb...
[ "Get", "pid", "informations", "." ]
74ad6b3fed9bc865896cafb12881e05043c1b171
https://github.com/soyuka/pidusage/blob/74ad6b3fed9bc865896cafb12881e05043c1b171/index.js#L14-L35
train
soyuka/pidusage
lib/ps.js
ps
function ps (pids, options, done) { var pArg = pids.join(',') var args = ['-o', 'etime,pid,ppid,pcpu,rss,time', '-p', pArg] if (PLATFORM === 'aix') { args = ['-o', 'etime,pid,ppid,pcpu,rssize,time', '-p', pArg] } bin('ps', args, function (err, stdout, code) { if (err) return done(err) if (code =...
javascript
function ps (pids, options, done) { var pArg = pids.join(',') var args = ['-o', 'etime,pid,ppid,pcpu,rss,time', '-p', pArg] if (PLATFORM === 'aix') { args = ['-o', 'etime,pid,ppid,pcpu,rssize,time', '-p', pArg] } bin('ps', args, function (err, stdout, code) { if (err) return done(err) if (code =...
[ "function", "ps", "(", "pids", ",", "options", ",", "done", ")", "{", "var", "pArg", "=", "pids", ".", "join", "(", "','", ")", "var", "args", "=", "[", "'-o'", ",", "'etime,pid,ppid,pcpu,rss,time'", ",", "'-p'", ",", "pArg", "]", "if", "(", "PLATFOR...
Get pid informations through ps command. @param {Number[]} pids @param {Object} options @param {Function} done(err, stat)
[ "Get", "pid", "informations", "through", "ps", "command", "." ]
74ad6b3fed9bc865896cafb12881e05043c1b171
https://github.com/soyuka/pidusage/blob/74ad6b3fed9bc865896cafb12881e05043c1b171/lib/ps.js#L37-L124
train
stream-utils/raw-body
index.js
getDecoder
function getDecoder (encoding) { if (!encoding) return null try { return iconv.getDecoder(encoding) } catch (e) { // error getting decoder if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e // the encoding was not found throw createError(415, 'specified encoding unsupported', { ...
javascript
function getDecoder (encoding) { if (!encoding) return null try { return iconv.getDecoder(encoding) } catch (e) { // error getting decoder if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e // the encoding was not found throw createError(415, 'specified encoding unsupported', { ...
[ "function", "getDecoder", "(", "encoding", ")", "{", "if", "(", "!", "encoding", ")", "return", "null", "try", "{", "return", "iconv", ".", "getDecoder", "(", "encoding", ")", "}", "catch", "(", "e", ")", "{", "// error getting decoder", "if", "(", "!", ...
Get the decoder for a given encoding. @param {string} encoding @private
[ "Get", "the", "decoder", "for", "a", "given", "encoding", "." ]
bf4f3d1ef5d7277233f08f31d52a5ff36337d573
https://github.com/stream-utils/raw-body/blob/bf4f3d1ef5d7277233f08f31d52a5ff36337d573/index.js#L41-L56
train
brianc/node-sql
lib/node/index.js
function(query, dialect) { var sql = query.sql || (query.table && query.table.sql); var Dialect; if (dialect) { // dialect is specified Dialect = getDialect(dialect); } else if (sql && sql.dialect) { // dialect is not specified, use the dialect from the sql instance Dialect = sql.dialect; } e...
javascript
function(query, dialect) { var sql = query.sql || (query.table && query.table.sql); var Dialect; if (dialect) { // dialect is specified Dialect = getDialect(dialect); } else if (sql && sql.dialect) { // dialect is not specified, use the dialect from the sql instance Dialect = sql.dialect; } e...
[ "function", "(", "query", ",", "dialect", ")", "{", "var", "sql", "=", "query", ".", "sql", "||", "(", "query", ".", "table", "&&", "query", ".", "table", ".", "sql", ")", ";", "var", "Dialect", ";", "if", "(", "dialect", ")", "{", "// dialect is s...
Before the change that introduced parallel dialects, every node could be turned into a query. The parallel dialects change made it impossible to change some nodes into a query because not all nodes are constructed with the sql instance.
[ "Before", "the", "change", "that", "introduced", "parallel", "dialects", "every", "node", "could", "be", "turned", "into", "a", "query", ".", "The", "parallel", "dialects", "change", "made", "it", "impossible", "to", "change", "some", "nodes", "into", "a", "...
95d775a9a10650c2de34edf23a1a859abf7744dc
https://github.com/brianc/node-sql/blob/95d775a9a10650c2de34edf23a1a859abf7744dc/lib/node/index.js#L35-L50
train
brianc/node-sql
lib/dialect/mssql.js
getModifierValue
function getModifierValue(dialect,node){ return node.count.type ? dialect.visit(node.count) : node.count; }
javascript
function getModifierValue(dialect,node){ return node.count.type ? dialect.visit(node.count) : node.count; }
[ "function", "getModifierValue", "(", "dialect", ",", "node", ")", "{", "return", "node", ".", "count", ".", "type", "?", "dialect", ".", "visit", "(", "node", ".", "count", ")", ":", "node", ".", "count", ";", "}" ]
Node is either an OFFSET or LIMIT node
[ "Node", "is", "either", "an", "OFFSET", "or", "LIMIT", "node" ]
95d775a9a10650c2de34edf23a1a859abf7744dc
https://github.com/brianc/node-sql/blob/95d775a9a10650c2de34edf23a1a859abf7744dc/lib/dialect/mssql.js#L411-L413
train
othiym23/node-continuation-local-storage
context.js
attach
function attach(listener) { if (!listener) return; if (!listener[CONTEXTS_SYMBOL]) listener[CONTEXTS_SYMBOL] = Object.create(null); listener[CONTEXTS_SYMBOL][thisSymbol] = { namespace : namespace, context : namespace.active }; }
javascript
function attach(listener) { if (!listener) return; if (!listener[CONTEXTS_SYMBOL]) listener[CONTEXTS_SYMBOL] = Object.create(null); listener[CONTEXTS_SYMBOL][thisSymbol] = { namespace : namespace, context : namespace.active }; }
[ "function", "attach", "(", "listener", ")", "{", "if", "(", "!", "listener", ")", "return", ";", "if", "(", "!", "listener", "[", "CONTEXTS_SYMBOL", "]", ")", "listener", "[", "CONTEXTS_SYMBOL", "]", "=", "Object", ".", "create", "(", "null", ")", ";",...
Capture the context active at the time the emitter is bound.
[ "Capture", "the", "context", "active", "at", "the", "time", "the", "emitter", "is", "bound", "." ]
fc770288979f6050e4371c1e1b44d2b76b233664
https://github.com/othiym23/node-continuation-local-storage/blob/fc770288979f6050e4371c1e1b44d2b76b233664/context.js#L131-L139
train
othiym23/node-continuation-local-storage
context.js
bind
function bind(unwrapped) { if (!(unwrapped && unwrapped[CONTEXTS_SYMBOL])) return unwrapped; var wrapped = unwrapped; var contexts = unwrapped[CONTEXTS_SYMBOL]; Object.keys(contexts).forEach(function (name) { var thunk = contexts[name]; wrapped = thunk.namespace.bind(wrapped, thunk.context...
javascript
function bind(unwrapped) { if (!(unwrapped && unwrapped[CONTEXTS_SYMBOL])) return unwrapped; var wrapped = unwrapped; var contexts = unwrapped[CONTEXTS_SYMBOL]; Object.keys(contexts).forEach(function (name) { var thunk = contexts[name]; wrapped = thunk.namespace.bind(wrapped, thunk.context...
[ "function", "bind", "(", "unwrapped", ")", "{", "if", "(", "!", "(", "unwrapped", "&&", "unwrapped", "[", "CONTEXTS_SYMBOL", "]", ")", ")", "return", "unwrapped", ";", "var", "wrapped", "=", "unwrapped", ";", "var", "contexts", "=", "unwrapped", "[", "CO...
At emit time, bind the listener within the correct context.
[ "At", "emit", "time", "bind", "the", "listener", "within", "the", "correct", "context", "." ]
fc770288979f6050e4371c1e1b44d2b76b233664
https://github.com/othiym23/node-continuation-local-storage/blob/fc770288979f6050e4371c1e1b44d2b76b233664/context.js#L142-L152
train
Kong/unirest-nodejs
index.js
function (name, path, options) { options = options || {} options.attachment = true return handleField(name, path, options) }
javascript
function (name, path, options) { options = options || {} options.attachment = true return handleField(name, path, options) }
[ "function", "(", "name", ",", "path", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", "options", ".", "attachment", "=", "true", "return", "handleField", "(", "name", ",", "path", ",", "options", ")", "}" ]
Attaches a file to the multipart-form request. @param {String} name @param {String|Object} path @return {Object}
[ "Attaches", "a", "file", "to", "the", "multipart", "-", "form", "request", "." ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L136-L140
train
Kong/unirest-nodejs
index.js
function (name, value, options) { $this._multipart.push({ name: name, value: value, options: options, attachment: options.attachment || false }) }
javascript
function (name, value, options) { $this._multipart.push({ name: name, value: value, options: options, attachment: options.attachment || false }) }
[ "function", "(", "name", ",", "value", ",", "options", ")", "{", "$this", ".", "_multipart", ".", "push", "(", "{", "name", ":", "name", ",", "value", ":", "value", ",", "options", ":", "options", ",", "attachment", ":", "options", ".", "attachment", ...
Attaches field to the multipart-form request, with no pre-processing. @param {String} name @param {String|Object} path @param {Object} options @return {Object}
[ "Attaches", "field", "to", "the", "multipart", "-", "form", "request", "with", "no", "pre", "-", "processing", "." ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L150-L157
train
Kong/unirest-nodejs
index.js
function (user, password, sendImmediately) { $this.options.auth = (is(user).a(Object)) ? user : { user: user, password: password, sendImmediately: sendImmediately } return $this }
javascript
function (user, password, sendImmediately) { $this.options.auth = (is(user).a(Object)) ? user : { user: user, password: password, sendImmediately: sendImmediately } return $this }
[ "function", "(", "user", ",", "password", ",", "sendImmediately", ")", "{", "$this", ".", "options", ".", "auth", "=", "(", "is", "(", "user", ")", ".", "a", "(", "Object", ")", ")", "?", "user", ":", "{", "user", ":", "user", ",", "password", ":...
Basic Header Authentication Method Supports user being an Object to reflect Request Supports user, password to reflect SuperAgent @param {String|Object} user @param {String} password @param {Boolean} sendImmediately @return {Object}
[ "Basic", "Header", "Authentication", "Method" ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L170-L178
train
Kong/unirest-nodejs
index.js
function (field, value) { if (is(field).a(Object)) { for (var key in field) { if (Object.prototype.hasOwnProperty.call(field, key)) { $this.header(key, field[key]) } } return $this } var existingHeaderName = $this.hasHeader(fi...
javascript
function (field, value) { if (is(field).a(Object)) { for (var key in field) { if (Object.prototype.hasOwnProperty.call(field, key)) { $this.header(key, field[key]) } } return $this } var existingHeaderName = $this.hasHeader(fi...
[ "function", "(", "field", ",", "value", ")", "{", "if", "(", "is", "(", "field", ")", ".", "a", "(", "Object", ")", ")", "{", "for", "(", "var", "key", "in", "field", ")", "{", "if", "(", "Object", ".", "prototype", ".", "hasOwnProperty", ".", ...
Sets header field to value @param {String} field Header field @param {String} value Header field value @return {Object}
[ "Sets", "header", "field", "to", "value" ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L187-L202
train
Kong/unirest-nodejs
index.js
function (value) { if (is(value).a(Object)) value = Unirest.serializers.form(value) if (!value.length) return $this $this.options.url += (does($this.options.url).contain('?') ? '&' : '?') + value return $this }
javascript
function (value) { if (is(value).a(Object)) value = Unirest.serializers.form(value) if (!value.length) return $this $this.options.url += (does($this.options.url).contain('?') ? '&' : '?') + value return $this }
[ "function", "(", "value", ")", "{", "if", "(", "is", "(", "value", ")", ".", "a", "(", "Object", ")", ")", "value", "=", "Unirest", ".", "serializers", ".", "form", "(", "value", ")", "if", "(", "!", "value", ".", "length", ")", "return", "$this"...
Serialize value as querystring representation, and append or set on `Request.options.url` @param {String|Object} value @return {Object}
[ "Serialize", "value", "as", "querystring", "representation", "and", "append", "or", "set", "on", "Request", ".", "options", ".", "url" ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L210-L215
train
Kong/unirest-nodejs
index.js
function (data) { var type = $this.options.headers[$this.hasHeader('content-type')] if ((is(data).a(Object) || is(data).a(Array)) && !Buffer.isBuffer(data)) { if (!type) { $this.type('form') type = $this.options.headers[$this.hasHeader('content-type')] $thi...
javascript
function (data) { var type = $this.options.headers[$this.hasHeader('content-type')] if ((is(data).a(Object) || is(data).a(Array)) && !Buffer.isBuffer(data)) { if (!type) { $this.type('form') type = $this.options.headers[$this.hasHeader('content-type')] $thi...
[ "function", "(", "data", ")", "{", "var", "type", "=", "$this", ".", "options", ".", "headers", "[", "$this", ".", "hasHeader", "(", "'content-type'", ")", "]", "if", "(", "(", "is", "(", "data", ")", ".", "a", "(", "Object", ")", "||", "is", "("...
Data marshalling for HTTP request body data Determines whether type is `form` or `json`. For irregular mime-types the `.type()` method is used to infer the `content-type` header. When mime-type is `application/x-www-form-urlencoded` data is appended rather than overwritten. @param {Mixed} data @return {Object}
[ "Data", "marshalling", "for", "HTTP", "request", "body", "data" ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L241-L282
train
Kong/unirest-nodejs
index.js
function (options) { if (!$this._multipart) { $this.options.multipart = [] } if (is(options).a(Object)) { if (options['content-type']) { var type = Unirest.type(options['content-type'], true) if (type) options.body = Unirest.Response.parse(options.bod...
javascript
function (options) { if (!$this._multipart) { $this.options.multipart = [] } if (is(options).a(Object)) { if (options['content-type']) { var type = Unirest.type(options['content-type'], true) if (type) options.body = Unirest.Response.parse(options.bod...
[ "function", "(", "options", ")", "{", "if", "(", "!", "$this", ".", "_multipart", ")", "{", "$this", ".", "options", ".", "multipart", "=", "[", "]", "}", "if", "(", "is", "(", "options", ")", ".", "a", "(", "Object", ")", ")", "{", "if", "(", ...
Takes multipart options and places them on `options.multipart` array. Transforms body when an `Object` or _content-type_ is present. Example: Unirest.get('http://google.com').part({ 'content-type': 'application/json', body: { phrase: 'Hello' } }).part({ 'content-type': 'application/json', body: { phrase: 'World' } })...
[ "Takes", "multipart", "options", "and", "places", "them", "on", "options", ".", "multipart", "array", ".", "Transforms", "body", "when", "an", "Object", "or", "_content", "-", "type_", "is", "present", "." ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L306-L329
train
Kong/unirest-nodejs
index.js
handleField
function handleField (name, value, options) { var serialized var length var key var i options = options || { attachment: false } if (is(name).a(Object)) { for (key in name) { if (Object.prototype.hasOwnProperty.call(name, key)) { handleField(key, name[...
javascript
function handleField (name, value, options) { var serialized var length var key var i options = options || { attachment: false } if (is(name).a(Object)) { for (key in name) { if (Object.prototype.hasOwnProperty.call(name, key)) { handleField(key, name[...
[ "function", "handleField", "(", "name", ",", "value", ",", "options", ")", "{", "var", "serialized", "var", "length", "var", "key", "var", "i", "options", "=", "options", "||", "{", "attachment", ":", "false", "}", "if", "(", "is", "(", "name", ")", ...
Handles Multipart Field Processing @param {String} name @param {Mixed} value @param {Object} options
[ "Handles", "Multipart", "Field", "Processing" ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L734-L762
train
Kong/unirest-nodejs
index.js
handleFieldValue
function handleFieldValue (value) { if (!(value instanceof Buffer || typeof value === 'string')) { if (is(value).a(Object)) { if (value instanceof fs.FileReadStream) { return value } else { return Unirest.serializers.json(value) } } else { ...
javascript
function handleFieldValue (value) { if (!(value instanceof Buffer || typeof value === 'string')) { if (is(value).a(Object)) { if (value instanceof fs.FileReadStream) { return value } else { return Unirest.serializers.json(value) } } else { ...
[ "function", "handleFieldValue", "(", "value", ")", "{", "if", "(", "!", "(", "value", "instanceof", "Buffer", "||", "typeof", "value", "===", "'string'", ")", ")", "{", "if", "(", "is", "(", "value", ")", ".", "a", "(", "Object", ")", ")", "{", "if...
Handles Multipart Value Processing @param {Mixed} value
[ "Handles", "Multipart", "Value", "Processing" ]
a06ba4e6c58fea028d377c170cb4cbf7cf3c6049
https://github.com/Kong/unirest-nodejs/blob/a06ba4e6c58fea028d377c170cb4cbf7cf3c6049/index.js#L769-L781
train
heiseonline/shariff
src/js/dom.js
dq
function dq(selector, context) { var nodes = [] context = context || document if (typeof selector === 'function') { if (context.attachEvent ? context.readyState === 'complete' : context.readyState !== 'loading') { selector() } else { context.addEventListener('DOMContentLoaded', selector) }...
javascript
function dq(selector, context) { var nodes = [] context = context || document if (typeof selector === 'function') { if (context.attachEvent ? context.readyState === 'complete' : context.readyState !== 'loading') { selector() } else { context.addEventListener('DOMContentLoaded', selector) }...
[ "function", "dq", "(", "selector", ",", "context", ")", "{", "var", "nodes", "=", "[", "]", "context", "=", "context", "||", "document", "if", "(", "typeof", "selector", "===", "'function'", ")", "{", "if", "(", "context", ".", "attachEvent", "?", "con...
Initialization helper. This method is this module's exported entry point. @param {string|Array|Element} selector - css selector, one element, array of nodes or html fragment @param {node} [context=document] - context node in which to query @returns {DOMQuery} A DOMQuery instance containing the selected set of nodes
[ "Initialization", "helper", ".", "This", "method", "is", "this", "module", "s", "exported", "entry", "point", "." ]
1a4a3e2f30ccd0b16581750df3abd82b4e013566
https://github.com/heiseonline/shariff/blob/1a4a3e2f30ccd0b16581750df3abd82b4e013566/src/js/dom.js#L35-L56
train
heiseonline/shariff
src/js/dom.js
DOMQuery
function DOMQuery(elements, context) { this.length = elements.length this.context = context var self = this each(elements, function(i) { self[i] = this }) }
javascript
function DOMQuery(elements, context) { this.length = elements.length this.context = context var self = this each(elements, function(i) { self[i] = this }) }
[ "function", "DOMQuery", "(", "elements", ",", "context", ")", "{", "this", ".", "length", "=", "elements", ".", "length", "this", ".", "context", "=", "context", "var", "self", "=", "this", "each", "(", "elements", ",", "function", "(", "i", ")", "{", ...
Contains a set of DOM nodes and provides methods to manipulate the nodes. @constructor
[ "Contains", "a", "set", "of", "DOM", "nodes", "and", "provides", "methods", "to", "manipulate", "the", "nodes", "." ]
1a4a3e2f30ccd0b16581750df3abd82b4e013566
https://github.com/heiseonline/shariff/blob/1a4a3e2f30ccd0b16581750df3abd82b4e013566/src/js/dom.js#L62-L67
train
heiseonline/shariff
src/js/dom.js
function (parent, nodes) { for (var i = nodes.length - 1; i >= 0; i--) { parent.insertBefore(nodes[nodes.length - 1], parent.firstChild) } }
javascript
function (parent, nodes) { for (var i = nodes.length - 1; i >= 0; i--) { parent.insertBefore(nodes[nodes.length - 1], parent.firstChild) } }
[ "function", "(", "parent", ",", "nodes", ")", "{", "for", "(", "var", "i", "=", "nodes", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "parent", ".", "insertBefore", "(", "nodes", "[", "nodes", ".", "length", "-", "1",...
Prepends an array of nodes to the top of an HTML element. @param {Element} parent - Element to prepend to @param {Array} nodes - Collection of nodes to prepend @private
[ "Prepends", "an", "array", "of", "nodes", "to", "the", "top", "of", "an", "HTML", "element", "." ]
1a4a3e2f30ccd0b16581750df3abd82b4e013566
https://github.com/heiseonline/shariff/blob/1a4a3e2f30ccd0b16581750df3abd82b4e013566/src/js/dom.js#L316-L320
train
heiseonline/shariff
src/js/dom.js
function (selector, event, handler, scope) { (scope || document).addEventListener(event, function(event) { var listeningTarget = closest(event.target, selector) if (listeningTarget) { handler.call(listeningTarget, event) } }) }
javascript
function (selector, event, handler, scope) { (scope || document).addEventListener(event, function(event) { var listeningTarget = closest(event.target, selector) if (listeningTarget) { handler.call(listeningTarget, event) } }) }
[ "function", "(", "selector", ",", "event", ",", "handler", ",", "scope", ")", "{", "(", "scope", "||", "document", ")", ".", "addEventListener", "(", "event", ",", "function", "(", "event", ")", "{", "var", "listeningTarget", "=", "closest", "(", "event"...
An event handler. @callback eventHandler @param {Event} event - The event this handler was triggered for Delegates an event for a node matching a selector. @param {string} selector - The CSS selector @param {string} event - The event name @param {eventHandler} handler - The event handler function @param {HTMLElement...
[ "An", "event", "handler", "." ]
1a4a3e2f30ccd0b16581750df3abd82b4e013566
https://github.com/heiseonline/shariff/blob/1a4a3e2f30ccd0b16581750df3abd82b4e013566/src/js/dom.js#L360-L367
train
heiseonline/shariff
src/js/dom.js
function (value) { /* jshint maxcomplexity:7 */ // boolean if (value === 'true') { return true } if (value === 'false') { return false } // null if (value === 'null') { return null } // number if (+value + '' === value) { return +value } // json if (/^[[{]/.test(value)) { try { return JSON...
javascript
function (value) { /* jshint maxcomplexity:7 */ // boolean if (value === 'true') { return true } if (value === 'false') { return false } // null if (value === 'null') { return null } // number if (+value + '' === value) { return +value } // json if (/^[[{]/.test(value)) { try { return JSON...
[ "function", "(", "value", ")", "{", "/* jshint maxcomplexity:7 */", "// boolean", "if", "(", "value", "===", "'true'", ")", "{", "return", "true", "}", "if", "(", "value", "===", "'false'", ")", "{", "return", "false", "}", "// null", "if", "(", "value", ...
Deserializes JSON values from strings. Used with data attributes. @param {string} value - String to parse @returns {Object} @private
[ "Deserializes", "JSON", "values", "from", "strings", ".", "Used", "with", "data", "attributes", "." ]
1a4a3e2f30ccd0b16581750df3abd82b4e013566
https://github.com/heiseonline/shariff/blob/1a4a3e2f30ccd0b16581750df3abd82b4e013566/src/js/dom.js#L458-L477
train
Rosey/markdown-draft-js
src/draft-to-markdown.js
draftToMarkdown
function draftToMarkdown(rawDraftObject, options) { options = options || {}; var markdownString = ''; rawDraftObject.blocks.forEach(function (block, index) { markdownString += renderBlock(block, index, rawDraftObject, options); }); orderedListNumber = {}; // See variable definitions at the top of the pag...
javascript
function draftToMarkdown(rawDraftObject, options) { options = options || {}; var markdownString = ''; rawDraftObject.blocks.forEach(function (block, index) { markdownString += renderBlock(block, index, rawDraftObject, options); }); orderedListNumber = {}; // See variable definitions at the top of the pag...
[ "function", "draftToMarkdown", "(", "rawDraftObject", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "markdownString", "=", "''", ";", "rawDraftObject", ".", "blocks", ".", "forEach", "(", "function", "(", "block", ",", "i...
Generate markdown for a raw draftjs object DraftJS raw object contains an array of blocks, which is the main "structure" of the text. Each block = a new line. @param {Object} rawDraftObject - draftjs object to generate markdown for @param {Object} options - optional additional data, see readme for what options can be ...
[ "Generate", "markdown", "for", "a", "raw", "draftjs", "object", "DraftJS", "raw", "object", "contains", "an", "array", "of", "blocks", "which", "is", "the", "main", "structure", "of", "the", "text", ".", "Each", "block", "=", "a", "new", "line", "." ]
8d415755fec9edad1fc9d8b531fbc7aff4436f2a
https://github.com/Rosey/markdown-draft-js/blob/8d415755fec9edad1fc9d8b531fbc7aff4436f2a/src/draft-to-markdown.js#L488-L497
train
stylus/nib
lib/nodes/gradient.js
Gradient
function Gradient(size, start) { this.size = size; this.canvas = new Canvas(1, 1); this.setStartPosition(start); this.ctx = this.canvas.getContext('2d'); this.grad = this.ctx.createLinearGradient( this.from[0], this.from[1], this.to[0], this.to[1]); }
javascript
function Gradient(size, start) { this.size = size; this.canvas = new Canvas(1, 1); this.setStartPosition(start); this.ctx = this.canvas.getContext('2d'); this.grad = this.ctx.createLinearGradient( this.from[0], this.from[1], this.to[0], this.to[1]); }
[ "function", "Gradient", "(", "size", ",", "start", ")", "{", "this", ".", "size", "=", "size", ";", "this", ".", "canvas", "=", "new", "Canvas", "(", "1", ",", "1", ")", ";", "this", ".", "setStartPosition", "(", "start", ")", ";", "this", ".", "...
Initialize a new `Gradient` node with the given `size` and `start` position. @param {Number} size @param {String} start @api private
[ "Initialize", "a", "new", "Gradient", "node", "with", "the", "given", "size", "and", "start", "position", "." ]
5ba7db7768e4668044c0d4d94585559d8f73a6ac
https://github.com/stylus/nib/blob/5ba7db7768e4668044c0d4d94585559d8f73a6ac/lib/nodes/gradient.js#L72-L80
train
stylus/nib
lib/nodes/vendor-helpers.js
normalize
function normalize(property, value, prefix){ var result = value.toString(), args; /* Fixing the gradients */ if (~result.indexOf('gradient(')) { /* Normalize color stops */ result = result.replace(RE_GRADIENT_STOPS,'$1$4$3$2'); /* Normalize legacy gradients */ result = result.replace(RE_G...
javascript
function normalize(property, value, prefix){ var result = value.toString(), args; /* Fixing the gradients */ if (~result.indexOf('gradient(')) { /* Normalize color stops */ result = result.replace(RE_GRADIENT_STOPS,'$1$4$3$2'); /* Normalize legacy gradients */ result = result.replace(RE_G...
[ "function", "normalize", "(", "property", ",", "value", ",", "prefix", ")", "{", "var", "result", "=", "value", ".", "toString", "(", ")", ",", "args", ";", "/* Fixing the gradients */", "if", "(", "~", "result", ".", "indexOf", "(", "'gradient('", ")", ...
Expose `normalize`.
[ "Expose", "normalize", "." ]
5ba7db7768e4668044c0d4d94585559d8f73a6ac
https://github.com/stylus/nib/blob/5ba7db7768e4668044c0d4d94585559d8f73a6ac/lib/nodes/vendor-helpers.js#L13-L44
train
stylus/nib
lib/nodes/color-image.js
ColorImage
function ColorImage(color) { this.color = color; this.canvas = new Canvas(1, 1); this.ctx = this.canvas.getContext('2d'); this.ctx.fillStyle = color.toString(); this.ctx.fillRect(0, 0, 1, 1); }
javascript
function ColorImage(color) { this.color = color; this.canvas = new Canvas(1, 1); this.ctx = this.canvas.getContext('2d'); this.ctx.fillStyle = color.toString(); this.ctx.fillRect(0, 0, 1, 1); }
[ "function", "ColorImage", "(", "color", ")", "{", "this", ".", "color", "=", "color", ";", "this", ".", "canvas", "=", "new", "Canvas", "(", "1", ",", "1", ")", ";", "this", ".", "ctx", "=", "this", ".", "canvas", ".", "getContext", "(", "'2d'", ...
Initialize a new `ColorImage` node with the given arguments. @param {Color} color node @api private
[ "Initialize", "a", "new", "ColorImage", "node", "with", "the", "given", "arguments", "." ]
5ba7db7768e4668044c0d4d94585559d8f73a6ac
https://github.com/stylus/nib/blob/5ba7db7768e4668044c0d4d94585559d8f73a6ac/lib/nodes/color-image.js#L49-L55
train
paypal/react-engine
lib/util.js
clearRequireCacheInDir
function clearRequireCacheInDir(dir, extension) { var options = { cwd: dir }; // find all files with the `extension` in the express view directory // and clean them out of require's cache. var files = glob.sync('**/*.' + extension, options); files.map(function(file) { clearRequireCache(dir + path...
javascript
function clearRequireCacheInDir(dir, extension) { var options = { cwd: dir }; // find all files with the `extension` in the express view directory // and clean them out of require's cache. var files = glob.sync('**/*.' + extension, options); files.map(function(file) { clearRequireCache(dir + path...
[ "function", "clearRequireCacheInDir", "(", "dir", ",", "extension", ")", "{", "var", "options", "=", "{", "cwd", ":", "dir", "}", ";", "// find all files with the `extension` in the express view directory", "// and clean them out of require's cache.", "var", "files", "=", ...
clears require cache of files that have extension `extension` from a given directory `dir`.
[ "clears", "require", "cache", "of", "files", "that", "have", "extension", "extension", "from", "a", "given", "directory", "dir", "." ]
96e371cb5e2484dbe637492f7aa218127fd0ca06
https://github.com/paypal/react-engine/blob/96e371cb5e2484dbe637492f7aa218127fd0ca06/lib/util.js#L30-L43
train
paypal/react-engine
lib/client.js
function(component) { if (options.reduxStoreInitiator && isFunction(options.reduxStoreInitiator)) { var initStore = options.reduxStoreInitiator; if (initStore.default) { initStore = initStore.default; } var store = initStore(props); var Provider = require('react-redux').Provide...
javascript
function(component) { if (options.reduxStoreInitiator && isFunction(options.reduxStoreInitiator)) { var initStore = options.reduxStoreInitiator; if (initStore.default) { initStore = initStore.default; } var store = initStore(props); var Provider = require('react-redux').Provide...
[ "function", "(", "component", ")", "{", "if", "(", "options", ".", "reduxStoreInitiator", "&&", "isFunction", "(", "options", ".", "reduxStoreInitiator", ")", ")", "{", "var", "initStore", "=", "options", ".", "reduxStoreInitiator", ";", "if", "(", "initStore"...
wrap component with react-redux Proivder if redux is required
[ "wrap", "component", "with", "react", "-", "redux", "Proivder", "if", "redux", "is", "required" ]
96e371cb5e2484dbe637492f7aa218127fd0ca06
https://github.com/paypal/react-engine/blob/96e371cb5e2484dbe637492f7aa218127fd0ca06/lib/client.js#L76-L88
train
simonlast/node-persist
src/node-persist.js
mixin
function mixin (target, source, options) { options = options || {}; options.skip = options.skip || []; for (let key in source) { if (typeof source[key] === 'function' && key.indexOf('_') !== 0 && options.skip.indexOf(key) === -1) { target[key] = source[key].bind(sourc...
javascript
function mixin (target, source, options) { options = options || {}; options.skip = options.skip || []; for (let key in source) { if (typeof source[key] === 'function' && key.indexOf('_') !== 0 && options.skip.indexOf(key) === -1) { target[key] = source[key].bind(sourc...
[ "function", "mixin", "(", "target", ",", "source", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "options", ".", "skip", "=", "options", ".", "skip", "||", "[", "]", ";", "for", "(", "let", "key", "in", "source", ")", ...
expose all the API methods on the main module using a default instance
[ "expose", "all", "the", "API", "methods", "on", "the", "main", "module", "using", "a", "default", "instance" ]
065eadd3a96f342b1d2e70f8cff5038ad657d3b7
https://github.com/simonlast/node-persist/blob/065eadd3a96f342b1d2e70f8cff5038ad657d3b7/src/node-persist.js#L31-L39
train
jaredhanson/electrolyte
lib/errors/interfacenotfound.js
InterfaceNotFoundError
function InterfaceNotFoundError(message, iface) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.message = message; this.code = 'INTERFACE_NOT_FOUND'; this.interface = iface; }
javascript
function InterfaceNotFoundError(message, iface) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.message = message; this.code = 'INTERFACE_NOT_FOUND'; this.interface = iface; }
[ "function", "InterfaceNotFoundError", "(", "message", ",", "iface", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "arguments", ".", "callee", ")", ";", "this", ".", "message", "=", "message", ...
`InterfaceNotFoundError` error. @api public
[ "InterfaceNotFoundError", "error", "." ]
3ab5c374095eaa68366386b5734b9397aa4f8c69
https://github.com/jaredhanson/electrolyte/blob/3ab5c374095eaa68366386b5734b9397aa4f8c69/lib/errors/interfacenotfound.js#L6-L12
train
jaredhanson/electrolyte
lib/injectedcontainer.js
InjectedContainer
function InjectedContainer(c, parent) { var pasm = parent ? parent._assembly : undefined; this._c = c; this._parent = parent; this._ns = (pasm && pasm.namespace) || ''; }
javascript
function InjectedContainer(c, parent) { var pasm = parent ? parent._assembly : undefined; this._c = c; this._parent = parent; this._ns = (pasm && pasm.namespace) || ''; }
[ "function", "InjectedContainer", "(", "c", ",", "parent", ")", "{", "var", "pasm", "=", "parent", "?", "parent", ".", "_assembly", ":", "undefined", ";", "this", ".", "_c", "=", "c", ";", "this", ".", "_parent", "=", "parent", ";", "this", ".", "_ns"...
Container wrapper used when injected into a factory. When a factory requires that the container itself be injected, the container is first wrapped. This wrapper provides an interface that can be used by the factory to introspect its environment, which is useful when loading plugins, among other functionality. The wr...
[ "Container", "wrapper", "used", "when", "injected", "into", "a", "factory", "." ]
3ab5c374095eaa68366386b5734b9397aa4f8c69
https://github.com/jaredhanson/electrolyte/blob/3ab5c374095eaa68366386b5734b9397aa4f8c69/lib/injectedcontainer.js#L23-L29
train
jaredhanson/electrolyte
lib/patterns/literal.js
LiteralComponent
function LiteralComponent(id, obj, asm) { Component.call(this, id, obj, asm); this._instance = obj; }
javascript
function LiteralComponent(id, obj, asm) { Component.call(this, id, obj, asm); this._instance = obj; }
[ "function", "LiteralComponent", "(", "id", ",", "obj", ",", "asm", ")", "{", "Component", ".", "call", "(", "this", ",", "id", ",", "obj", ",", "asm", ")", ";", "this", ".", "_instance", "=", "obj", ";", "}" ]
A component that is an object literal. A literal is returned directly when created by the IoC container. Due to the nature of being a literal, no dependencies are injected and only a single instance of the object will be created. If a module exports a primitive type (object, string, number, etc.), the IoC container ...
[ "A", "component", "that", "is", "an", "object", "literal", "." ]
3ab5c374095eaa68366386b5734b9397aa4f8c69
https://github.com/jaredhanson/electrolyte/blob/3ab5c374095eaa68366386b5734b9397aa4f8c69/lib/patterns/literal.js#L26-L29
train
jaredhanson/electrolyte
lib/patterns/factory.js
FactoryComponent
function FactoryComponent(id, fn, asm) { Component.call(this, id, fn, asm); this._fn = fn; }
javascript
function FactoryComponent(id, fn, asm) { Component.call(this, id, fn, asm); this._fn = fn; }
[ "function", "FactoryComponent", "(", "id", ",", "fn", ",", "asm", ")", "{", "Component", ".", "call", "(", "this", ",", "id", ",", "fn", ",", "asm", ")", ";", "this", ".", "_fn", "=", "fn", ";", "}" ]
A component created using a factory function. Objects will be created by calling the factory function with any required dependencies and returning the result. @constructor @param {string} id - The id of the component. @param {object} fn - The module containing the object factory. @param {number} asm - The assembly fr...
[ "A", "component", "created", "using", "a", "factory", "function", "." ]
3ab5c374095eaa68366386b5734b9397aa4f8c69
https://github.com/jaredhanson/electrolyte/blob/3ab5c374095eaa68366386b5734b9397aa4f8c69/lib/patterns/factory.js#L19-L22
train
jaredhanson/electrolyte
lib/errors/componentnotfound.js
ComponentNotFoundError
function ComponentNotFoundError(message) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.message = message; this.code = 'COMPONENT_NOT_FOUND'; }
javascript
function ComponentNotFoundError(message) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.message = message; this.code = 'COMPONENT_NOT_FOUND'; }
[ "function", "ComponentNotFoundError", "(", "message", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "arguments", ".", "callee", ")", ";", "this", ".", "message", "=", "message", ";", "this", "...
`ComponentNotFoundError` error. @api public
[ "ComponentNotFoundError", "error", "." ]
3ab5c374095eaa68366386b5734b9397aa4f8c69
https://github.com/jaredhanson/electrolyte/blob/3ab5c374095eaa68366386b5734b9397aa4f8c69/lib/errors/componentnotfound.js#L6-L11
train
jaredhanson/electrolyte
lib/errors/componentcreate.js
ComponentCreateError
function ComponentCreateError(message) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.message = message; this.code = 'COMPONENT_CREATE_ERROR'; }
javascript
function ComponentCreateError(message) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.message = message; this.code = 'COMPONENT_CREATE_ERROR'; }
[ "function", "ComponentCreateError", "(", "message", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "arguments", ".", "callee", ")", ";", "this", ".", "message", "=", "message", ";", "this", "."...
`ComponentCreateError` error. @api public
[ "ComponentCreateError", "error", "." ]
3ab5c374095eaa68366386b5734b9397aa4f8c69
https://github.com/jaredhanson/electrolyte/blob/3ab5c374095eaa68366386b5734b9397aa4f8c69/lib/errors/componentcreate.js#L6-L11
train