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
angular/material
src/components/dialog/dialog.js
function(ev) { if (sourceElem === target[0] && ev.target === target[0]) { ev.stopPropagation(); ev.preventDefault(); smartClose(); } }
javascript
function(ev) { if (sourceElem === target[0] && ev.target === target[0]) { ev.stopPropagation(); ev.preventDefault(); smartClose(); } }
[ "function", "(", "ev", ")", "{", "if", "(", "sourceElem", "===", "target", "[", "0", "]", "&&", "ev", ".", "target", "===", "target", "[", "0", "]", ")", "{", "ev", ".", "stopPropagation", "(", ")", ";", "ev", ".", "preventDefault", "(", ")", ";"...
We check if our original element and the target is the backdrop because if the original was the backdrop and the target was inside the dialog we don't want to dialog to close.
[ "We", "check", "if", "our", "original", "element", "and", "the", "target", "is", "the", "backdrop", "because", "if", "the", "original", "was", "the", "backdrop", "and", "the", "target", "was", "inside", "the", "dialog", "we", "don", "t", "want", "to", "d...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1009-L1016
train
angular/material
src/components/dialog/dialog.js
configureAria
function configureAria(element, options) { var role = (options.$type === 'alert') ? 'alertdialog' : 'dialog'; var dialogContent = element.find('md-dialog-content'); var existingDialogId = element.attr('id'); var dialogContentId = 'dialogContent_' + (existingDialogId || $mdUtil.nextUid()); ...
javascript
function configureAria(element, options) { var role = (options.$type === 'alert') ? 'alertdialog' : 'dialog'; var dialogContent = element.find('md-dialog-content'); var existingDialogId = element.attr('id'); var dialogContentId = 'dialogContent_' + (existingDialogId || $mdUtil.nextUid()); ...
[ "function", "configureAria", "(", "element", ",", "options", ")", "{", "var", "role", "=", "(", "options", ".", "$type", "===", "'alert'", ")", "?", "'alertdialog'", ":", "'dialog'", ";", "var", "dialogContent", "=", "element", ".", "find", "(", "'md-dialo...
Inject ARIA-specific attributes appropriate for Dialogs
[ "Inject", "ARIA", "-", "specific", "attributes", "appropriate", "for", "Dialogs" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1076-L1136
train
angular/material
src/components/dialog/dialog.js
lockScreenReader
function lockScreenReader(element, options) { var isHidden = true; // get raw DOM node walkDOM(element[0]); options.unlockScreenReader = function () { isHidden = false; walkDOM(element[0]); options.unlockScreenReader = null; }; /** * Get all of an e...
javascript
function lockScreenReader(element, options) { var isHidden = true; // get raw DOM node walkDOM(element[0]); options.unlockScreenReader = function () { isHidden = false; walkDOM(element[0]); options.unlockScreenReader = null; }; /** * Get all of an e...
[ "function", "lockScreenReader", "(", "element", ",", "options", ")", "{", "var", "isHidden", "=", "true", ";", "// get raw DOM node", "walkDOM", "(", "element", "[", "0", "]", ")", ";", "options", ".", "unlockScreenReader", "=", "function", "(", ")", "{", ...
Prevents screen reader interaction behind modal window on swipe interfaces
[ "Prevents", "screen", "reader", "interaction", "behind", "modal", "window", "on", "swipe", "interfaces" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1142-L1190
train
angular/material
src/components/dialog/dialog.js
getParents
function getParents(element) { var parents = []; while (element.parentNode) { if (element === document.body) { return parents; } var children = element.parentNode.children; for (var i = 0; i < children.length; i++) { // skip over child if i...
javascript
function getParents(element) { var parents = []; while (element.parentNode) { if (element === document.body) { return parents; } var children = element.parentNode.children; for (var i = 0; i < children.length; i++) { // skip over child if i...
[ "function", "getParents", "(", "element", ")", "{", "var", "parents", "=", "[", "]", ";", "while", "(", "element", ".", "parentNode", ")", "{", "if", "(", "element", "===", "document", ".", "body", ")", "{", "return", "parents", ";", "}", "var", "chi...
Get all of an element's parent elements up the DOM tree @return {Array} The parent elements
[ "Get", "all", "of", "an", "element", "s", "parent", "elements", "up", "the", "DOM", "tree" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1159-L1178
train
angular/material
src/components/dialog/dialog.js
walkDOM
function walkDOM(element) { var elements = getParents(element); for (var i = 0; i < elements.length; i++) { elements[i].setAttribute('aria-hidden', isHidden); } }
javascript
function walkDOM(element) { var elements = getParents(element); for (var i = 0; i < elements.length; i++) { elements[i].setAttribute('aria-hidden', isHidden); } }
[ "function", "walkDOM", "(", "element", ")", "{", "var", "elements", "=", "getParents", "(", "element", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "elements", "[", "i", "]", ".",...
Walk DOM to apply or remove aria-hidden on sibling nodes and parent sibling nodes
[ "Walk", "DOM", "to", "apply", "or", "remove", "aria", "-", "hidden", "on", "sibling", "nodes", "and", "parent", "sibling", "nodes" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1184-L1189
train
angular/material
src/components/dialog/dialog.js
stretchDialogContainerToViewport
function stretchDialogContainerToViewport(container, options) { var isFixed = $window.getComputedStyle($document[0].body).position == 'fixed'; var backdrop = options.backdrop ? $window.getComputedStyle(options.backdrop[0]) : null; var height = backdrop ? Math.min($document[0].body.clientHeight, Math.c...
javascript
function stretchDialogContainerToViewport(container, options) { var isFixed = $window.getComputedStyle($document[0].body).position == 'fixed'; var backdrop = options.backdrop ? $window.getComputedStyle(options.backdrop[0]) : null; var height = backdrop ? Math.min($document[0].body.clientHeight, Math.c...
[ "function", "stretchDialogContainerToViewport", "(", "container", ",", "options", ")", "{", "var", "isFixed", "=", "$window", ".", "getComputedStyle", "(", "$document", "[", "0", "]", ".", "body", ")", ".", "position", "==", "'fixed'", ";", "var", "backdrop", ...
Ensure the dialog container fill-stretches to the viewport
[ "Ensure", "the", "dialog", "container", "fill", "-", "stretches", "to", "the", "viewport" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1195-L1219
train
angular/material
src/components/dialog/dialog.js
dialogPopIn
function dialogPopIn(container, options) { // Add the `md-dialog-container` to the DOM options.parent.append(container); options.reverseContainerStretch = stretchDialogContainerToViewport(container, options); var dialogEl = container.find('md-dialog'); var animator = $mdUtil.dom.animator;...
javascript
function dialogPopIn(container, options) { // Add the `md-dialog-container` to the DOM options.parent.append(container); options.reverseContainerStretch = stretchDialogContainerToViewport(container, options); var dialogEl = container.find('md-dialog'); var animator = $mdUtil.dom.animator;...
[ "function", "dialogPopIn", "(", "container", ",", "options", ")", "{", "// Add the `md-dialog-container` to the DOM", "options", ".", "parent", ".", "append", "(", "container", ")", ";", "options", ".", "reverseContainerStretch", "=", "stretchDialogContainerToViewport", ...
Dialog open and pop-in animation
[ "Dialog", "open", "and", "pop", "-", "in", "animation" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1224-L1284
train
angular/material
src/components/dialog/dialog.js
dialogPopOut
function dialogPopOut(container, options) { return options.reverseAnimate().then(function() { if (options.contentElement) { // When we use a contentElement, we want the element to be the same as before. // That means, that we have to clear all the animation properties, like transform. ...
javascript
function dialogPopOut(container, options) { return options.reverseAnimate().then(function() { if (options.contentElement) { // When we use a contentElement, we want the element to be the same as before. // That means, that we have to clear all the animation properties, like transform. ...
[ "function", "dialogPopOut", "(", "container", ",", "options", ")", "{", "return", "options", ".", "reverseAnimate", "(", ")", ".", "then", "(", "function", "(", ")", "{", "if", "(", "options", ".", "contentElement", ")", "{", "// When we use a contentElement, ...
Dialog close and pop-out animation
[ "Dialog", "close", "and", "pop", "-", "out", "animation" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L1289-L1297
train
angular/material
src/components/progressLinear/progress-linear.js
watchAttributes
function watchAttributes() { attr.$observe('value', function(value) { var percentValue = clamp(value); element.attr('aria-valuenow', percentValue); if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue); }); attr.$observe('mdBufferValue', function(value) { ani...
javascript
function watchAttributes() { attr.$observe('value', function(value) { var percentValue = clamp(value); element.attr('aria-valuenow', percentValue); if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue); }); attr.$observe('mdBufferValue', function(value) { ani...
[ "function", "watchAttributes", "(", ")", "{", "attr", ".", "$observe", "(", "'value'", ",", "function", "(", "value", ")", "{", "var", "percentValue", "=", "clamp", "(", "value", ")", ";", "element", ".", "attr", "(", "'aria-valuenow'", ",", "percentValue"...
Watch the value, md-buffer-value, and md-mode attributes
[ "Watch", "the", "value", "md", "-", "buffer", "-", "value", "and", "md", "-", "mode", "attributes" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/progressLinear/progress-linear.js#L104-L142
train
angular/material
src/components/progressLinear/progress-linear.js
validateMode
function validateMode() { if (angular.isUndefined(attr.mdMode)) { var hasValue = angular.isDefined(attr.value); var mode = hasValue ? MODE_DETERMINATE : MODE_INDETERMINATE; var info = "Auto-adding the missing md-mode='{0}' to the ProgressLinear element"; element.attr("md-mode", mod...
javascript
function validateMode() { if (angular.isUndefined(attr.mdMode)) { var hasValue = angular.isDefined(attr.value); var mode = hasValue ? MODE_DETERMINATE : MODE_INDETERMINATE; var info = "Auto-adding the missing md-mode='{0}' to the ProgressLinear element"; element.attr("md-mode", mod...
[ "function", "validateMode", "(", ")", "{", "if", "(", "angular", ".", "isUndefined", "(", "attr", ".", "mdMode", ")", ")", "{", "var", "hasValue", "=", "angular", ".", "isDefined", "(", "attr", ".", "value", ")", ";", "var", "mode", "=", "hasValue", ...
Auto-defaults the mode to either `determinate` or `indeterminate` mode; if not specified
[ "Auto", "-", "defaults", "the", "mode", "to", "either", "determinate", "or", "indeterminate", "mode", ";", "if", "not", "specified" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/progressLinear/progress-linear.js#L147-L155
train
angular/material
src/components/progressLinear/progress-linear.js
mode
function mode() { var value = (attr.mdMode || "").trim(); if (value) { switch (value) { case MODE_DETERMINATE: case MODE_INDETERMINATE: case MODE_BUFFER: case MODE_QUERY: break; default: value = MODE_INDETERMINATE; ...
javascript
function mode() { var value = (attr.mdMode || "").trim(); if (value) { switch (value) { case MODE_DETERMINATE: case MODE_INDETERMINATE: case MODE_BUFFER: case MODE_QUERY: break; default: value = MODE_INDETERMINATE; ...
[ "function", "mode", "(", ")", "{", "var", "value", "=", "(", "attr", ".", "mdMode", "||", "\"\"", ")", ".", "trim", "(", ")", ";", "if", "(", "value", ")", "{", "switch", "(", "value", ")", "{", "case", "MODE_DETERMINATE", ":", "case", "MODE_INDETE...
Is the md-mode a valid option?
[ "Is", "the", "md", "-", "mode", "a", "valid", "option?" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/progressLinear/progress-linear.js#L160-L175
train
angular/material
src/components/chips/chips.spec.js
updateInputCursor
function updateInputCursor() { if (isValidInput) { var inputLength = input[0].value.length; try { input[0].selectionStart = input[0].selectionEnd = inputLength; } catch (e) { // Chrome does not allow setting a selection for number in...
javascript
function updateInputCursor() { if (isValidInput) { var inputLength = input[0].value.length; try { input[0].selectionStart = input[0].selectionEnd = inputLength; } catch (e) { // Chrome does not allow setting a selection for number in...
[ "function", "updateInputCursor", "(", ")", "{", "if", "(", "isValidInput", ")", "{", "var", "inputLength", "=", "input", "[", "0", "]", ".", "value", ".", "length", ";", "try", "{", "input", "[", "0", "]", ".", "selectionStart", "=", "input", "[", "0...
Updates the cursor position of the input. This is necessary to test the cursor position.
[ "Updates", "the", "cursor", "position", "of", "the", "input", ".", "This", "is", "necessary", "to", "test", "the", "cursor", "position", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/chips/chips.spec.js#L814-L829
train
catapult-project/catapult
telemetry/telemetry/internal/actions/gesture_common.js
getBoundingRect
function getBoundingRect(el) { const clientRect = el.getBoundingClientRect(); const bound = { left: clientRect.left, top: clientRect.top, width: clientRect.width, height: clientRect.height }; let frame = el.ownerDocument.defaultView.frameElement; while (frame) { const ...
javascript
function getBoundingRect(el) { const clientRect = el.getBoundingClientRect(); const bound = { left: clientRect.left, top: clientRect.top, width: clientRect.width, height: clientRect.height }; let frame = el.ownerDocument.defaultView.frameElement; while (frame) { const ...
[ "function", "getBoundingRect", "(", "el", ")", "{", "const", "clientRect", "=", "el", ".", "getBoundingClientRect", "(", ")", ";", "const", "bound", "=", "{", "left", ":", "clientRect", ".", "left", ",", "top", ":", "clientRect", ".", "top", ",", "width"...
Returns the bounding rectangle wrt to the layout viewport.
[ "Returns", "the", "bounding", "rectangle", "wrt", "to", "the", "layout", "viewport", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/telemetry/telemetry/internal/actions/gesture_common.js#L15-L35
train
catapult-project/catapult
telemetry/telemetry/internal/actions/gesture_common.js
getPageScaleFactor
function getPageScaleFactor() { const pageScaleFactor = chrome.gpuBenchmarking.pageScaleFactor; return pageScaleFactor ? pageScaleFactor.apply(chrome.gpuBenchmarking) : 1; }
javascript
function getPageScaleFactor() { const pageScaleFactor = chrome.gpuBenchmarking.pageScaleFactor; return pageScaleFactor ? pageScaleFactor.apply(chrome.gpuBenchmarking) : 1; }
[ "function", "getPageScaleFactor", "(", ")", "{", "const", "pageScaleFactor", "=", "chrome", ".", "gpuBenchmarking", ".", "pageScaleFactor", ";", "return", "pageScaleFactor", "?", "pageScaleFactor", ".", "apply", "(", "chrome", ".", "gpuBenchmarking", ")", ":", "1"...
Chrome version before M50 doesn't have `pageScaleFactor` function, to run benchmark on them we will need this function to fail back gracefully
[ "Chrome", "version", "before", "M50", "doesn", "t", "have", "pageScaleFactor", "function", "to", "run", "benchmark", "on", "them", "we", "will", "need", "this", "function", "to", "fail", "back", "gracefully" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/telemetry/telemetry/internal/actions/gesture_common.js#L39-L42
train
catapult-project/catapult
telemetry/telemetry/internal/actions/gesture_common.js
getBoundingVisibleRect
function getBoundingVisibleRect(el) { // Get the element bounding rect in the layout viewport. const rect = getBoundingRect(el); // Apply the visual viewport transform (i.e. pinch-zoom) to the bounding // rect. The viewportX|Y values are in CSS pixels so they don't change // with page scale. We fir...
javascript
function getBoundingVisibleRect(el) { // Get the element bounding rect in the layout viewport. const rect = getBoundingRect(el); // Apply the visual viewport transform (i.e. pinch-zoom) to the bounding // rect. The viewportX|Y values are in CSS pixels so they don't change // with page scale. We fir...
[ "function", "getBoundingVisibleRect", "(", "el", ")", "{", "// Get the element bounding rect in the layout viewport.", "const", "rect", "=", "getBoundingRect", "(", "el", ")", ";", "// Apply the visual viewport transform (i.e. pinch-zoom) to the bounding", "// rect. The viewportX|Y v...
Returns the bounding rect in the visual viewport's coordinates.
[ "Returns", "the", "bounding", "rect", "in", "the", "visual", "viewport", "s", "coordinates", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/telemetry/telemetry/internal/actions/gesture_common.js#L59-L86
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/mutable-data.js
mutablePropertyChange
function mutablePropertyChange(inst, property, value, old, mutableData) { let isObject; if (mutableData) { isObject = (typeof value === 'object' && value !== null); // Pull `old` for Objects from temp cache, but treat `null` as a primitive if (isObject) { old = inst.__dataTemp[property]; } }...
javascript
function mutablePropertyChange(inst, property, value, old, mutableData) { let isObject; if (mutableData) { isObject = (typeof value === 'object' && value !== null); // Pull `old` for Objects from temp cache, but treat `null` as a primitive if (isObject) { old = inst.__dataTemp[property]; } }...
[ "function", "mutablePropertyChange", "(", "inst", ",", "property", ",", "value", ",", "old", ",", "mutableData", ")", "{", "let", "isObject", ";", "if", "(", "mutableData", ")", "{", "isObject", "=", "(", "typeof", "value", "===", "'object'", "&&", "value"...
Common implementation for mixin & behavior
[ "Common", "implementation", "for", "mixin", "&", "behavior" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/mutable-data.js#L13-L30
train
catapult-project/catapult
tracing/third_party/oboe/src/wire.js
wire
function wire (httpMethodName, contentSource, body, headers, withCredentials){ var oboeBus = pubSub(); // Wire the input stream in if we are given a content source. // This will usually be the case. If not, the instance created // will have to be passed content from an external source. if( conten...
javascript
function wire (httpMethodName, contentSource, body, headers, withCredentials){ var oboeBus = pubSub(); // Wire the input stream in if we are given a content source. // This will usually be the case. If not, the instance created // will have to be passed content from an external source. if( conten...
[ "function", "wire", "(", "httpMethodName", ",", "contentSource", ",", "body", ",", "headers", ",", "withCredentials", ")", "{", "var", "oboeBus", "=", "pubSub", "(", ")", ";", "// Wire the input stream in if we are given a content source.", "// This will usually be the ca...
This file sits just behind the API which is used to attain a new Oboe instance. It creates the new components that are required and introduces them to each other.
[ "This", "file", "sits", "just", "behind", "the", "API", "which", "is", "used", "to", "attain", "a", "new", "Oboe", "instance", ".", "It", "creates", "the", "new", "components", "that", "are", "required", "and", "introduces", "them", "to", "each", "other", ...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/wire.js#L7-L34
train
catapult-project/catapult
tracing/third_party/oboe/src/publicApi.js
oboe
function oboe(arg1) { // We use duck-typing to detect if the parameter given is a stream, with the // below list of parameters. // Unpipe and unshift would normally be present on a stream but this breaks // compatibility with Request streams. // See https://github.com/jimhigson/oboe.js/issues/65 ...
javascript
function oboe(arg1) { // We use duck-typing to detect if the parameter given is a stream, with the // below list of parameters. // Unpipe and unshift would normally be present on a stream but this breaks // compatibility with Request streams. // See https://github.com/jimhigson/oboe.js/issues/65 ...
[ "function", "oboe", "(", "arg1", ")", "{", "// We use duck-typing to detect if the parameter given is a stream, with the", "// below list of parameters.", "// Unpipe and unshift would normally be present on a stream but this breaks", "// compatibility with Request streams.", "// See https://gith...
export public API
[ "export", "public", "API" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/publicApi.js#L2-L49
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
announceAccessibleMessage
function announceAccessibleMessage(msg) { var element = document.createElement('div'); element.setAttribute('aria-live', 'polite'); element.style.position = 'relative'; element.style.left = '-9999px'; element.style.height = '0px'; element.innerText = msg; document.body.appendChild(element); window.setTi...
javascript
function announceAccessibleMessage(msg) { var element = document.createElement('div'); element.setAttribute('aria-live', 'polite'); element.style.position = 'relative'; element.style.left = '-9999px'; element.style.height = '0px'; element.innerText = msg; document.body.appendChild(element); window.setTi...
[ "function", "announceAccessibleMessage", "(", "msg", ")", "{", "var", "element", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "element", ".", "setAttribute", "(", "'aria-live'", ",", "'polite'", ")", ";", "element", ".", "style", ".", "posi...
Add an accessible message to the page that will be announced to users who have spoken feedback on, but will be invisible to all other users. It's removed right away so it doesn't clutter the DOM. @param {string} msg The text to be pronounced.
[ "Add", "an", "accessible", "message", "to", "the", "page", "that", "will", "be", "announced", "to", "users", "who", "have", "spoken", "feedback", "on", "but", "will", "be", "invisible", "to", "all", "other", "users", ".", "It", "s", "removed", "right", "...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L35-L46
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
url
function url(s) { // http://www.w3.org/TR/css3-values/#uris // Parentheses, commas, whitespace characters, single quotes (') and double // quotes (") appearing in a URI must be escaped with a backslash var s2 = s.replace(/(\(|\)|\,|\s|\'|\"|\\)/g, '\\$1'); // WebKit has a bug when it comes to URLs that end wi...
javascript
function url(s) { // http://www.w3.org/TR/css3-values/#uris // Parentheses, commas, whitespace characters, single quotes (') and double // quotes (") appearing in a URI must be escaped with a backslash var s2 = s.replace(/(\(|\)|\,|\s|\'|\"|\\)/g, '\\$1'); // WebKit has a bug when it comes to URLs that end wi...
[ "function", "url", "(", "s", ")", "{", "// http://www.w3.org/TR/css3-values/#uris", "// Parentheses, commas, whitespace characters, single quotes (') and double", "// quotes (\") appearing in a URI must be escaped with a backslash", "var", "s2", "=", "s", ".", "replace", "(", "/", ...
Generates a CSS url string. @param {string} s The URL to generate the CSS url for. @return {string} The CSS url string.
[ "Generates", "a", "CSS", "url", "string", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L53-L65
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
parseQueryParams
function parseQueryParams(location) { var params = {}; var query = unescape(location.search.substring(1)); var vars = query.split('&'); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split('='); params[pair[0]] = pair[1]; } return params; }
javascript
function parseQueryParams(location) { var params = {}; var query = unescape(location.search.substring(1)); var vars = query.split('&'); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split('='); params[pair[0]] = pair[1]; } return params; }
[ "function", "parseQueryParams", "(", "location", ")", "{", "var", "params", "=", "{", "}", ";", "var", "query", "=", "unescape", "(", "location", ".", "search", ".", "substring", "(", "1", ")", ")", ";", "var", "vars", "=", "query", ".", "split", "("...
Parses query parameters from Location. @param {Location} location The URL to generate the CSS url for. @return {Object} Dictionary containing name value pairs for URL
[ "Parses", "query", "parameters", "from", "Location", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L72-L81
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
setQueryParam
function setQueryParam(location, key, value) { var query = parseQueryParams(location); query[encodeURIComponent(key)] = encodeURIComponent(value); var newQuery = ''; for (var q in query) { newQuery += (newQuery ? '&' : '?') + q + '=' + query[q]; } return location.origin + location.pathname + newQuery ...
javascript
function setQueryParam(location, key, value) { var query = parseQueryParams(location); query[encodeURIComponent(key)] = encodeURIComponent(value); var newQuery = ''; for (var q in query) { newQuery += (newQuery ? '&' : '?') + q + '=' + query[q]; } return location.origin + location.pathname + newQuery ...
[ "function", "setQueryParam", "(", "location", ",", "key", ",", "value", ")", "{", "var", "query", "=", "parseQueryParams", "(", "location", ")", ";", "query", "[", "encodeURIComponent", "(", "key", ")", "]", "=", "encodeURIComponent", "(", "value", ")", ";...
Creates a new URL by appending or replacing the given query key and value. Not supporting URL with username and password. @param {Location} location The original URL. @param {string} key The query parameter name. @param {string} value The query parameter value. @return {string} The constructed new URL.
[ "Creates", "a", "new", "URL", "by", "appending", "or", "replacing", "the", "given", "query", "key", "and", "value", ".", "Not", "supporting", "URL", "with", "username", "and", "password", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L91-L101
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
disableTextSelectAndDrag
function disableTextSelectAndDrag(opt_allowSelectStart, opt_allowDragStart) { // Disable text selection. document.onselectstart = function(e) { if (!(opt_allowSelectStart && opt_allowSelectStart.call(this, e))) e.preventDefault(); }; // Disable dragging. document.ondragstart = function(e) { if ...
javascript
function disableTextSelectAndDrag(opt_allowSelectStart, opt_allowDragStart) { // Disable text selection. document.onselectstart = function(e) { if (!(opt_allowSelectStart && opt_allowSelectStart.call(this, e))) e.preventDefault(); }; // Disable dragging. document.ondragstart = function(e) { if ...
[ "function", "disableTextSelectAndDrag", "(", "opt_allowSelectStart", ",", "opt_allowDragStart", ")", "{", "// Disable text selection.", "document", ".", "onselectstart", "=", "function", "(", "e", ")", "{", "if", "(", "!", "(", "opt_allowSelectStart", "&&", "opt_allow...
Disables text selection and dragging, with optional whitelist callbacks. @param {function(Event):boolean=} opt_allowSelectStart Unless this function is defined and returns true, the onselectionstart event will be surpressed. @param {function(Event):boolean=} opt_allowDragStart Unless this function is defined and return...
[ "Disables", "text", "selection", "and", "dragging", "with", "optional", "whitelist", "callbacks", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L148-L160
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
queryRequiredElement
function queryRequiredElement(selectors, opt_context) { var element = (opt_context || document).querySelector(selectors); return assertInstanceof(element, HTMLElement, 'Missing required element: ' + selectors); }
javascript
function queryRequiredElement(selectors, opt_context) { var element = (opt_context || document).querySelector(selectors); return assertInstanceof(element, HTMLElement, 'Missing required element: ' + selectors); }
[ "function", "queryRequiredElement", "(", "selectors", ",", "opt_context", ")", "{", "var", "element", "=", "(", "opt_context", "||", "document", ")", ".", "querySelector", "(", "selectors", ")", ";", "return", "assertInstanceof", "(", "element", ",", "HTMLElemen...
Query an element that's known to exist by a selector. We use this instead of just calling querySelector and not checking the result because this lets us satisfy the JSCompiler type system. @param {string} selectors CSS selectors to query the element. @param {(!Document|!DocumentFragment|!Element)=} opt_context An optio...
[ "Query", "an", "element", "that", "s", "known", "to", "exist", "by", "a", "selector", ".", "We", "use", "this", "instead", "of", "just", "calling", "querySelector", "and", "not", "checking", "the", "result", "because", "this", "lets", "us", "satisfy", "the...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L207-L211
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
appendParam
function appendParam(url, key, value) { var param = encodeURIComponent(key) + '=' + encodeURIComponent(value); if (url.indexOf('?') == -1) return url + '?' + param; return url + '&' + param; }
javascript
function appendParam(url, key, value) { var param = encodeURIComponent(key) + '=' + encodeURIComponent(value); if (url.indexOf('?') == -1) return url + '?' + param; return url + '&' + param; }
[ "function", "appendParam", "(", "url", ",", "key", ",", "value", ")", "{", "var", "param", "=", "encodeURIComponent", "(", "key", ")", "+", "'='", "+", "encodeURIComponent", "(", "value", ")", ";", "if", "(", "url", ".", "indexOf", "(", "'?'", ")", "...
Creates a new URL which is the old URL with a GET param of key=value. @param {string} url The base URL. There is not sanity checking on the URL so it must be passed in a proper format. @param {string} key The key of the param. @param {string} value The value of the param. @return {string} The new URL.
[ "Creates", "a", "new", "URL", "which", "is", "the", "old", "URL", "with", "a", "GET", "param", "of", "key", "=", "value", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L250-L256
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
createElementWithClassName
function createElementWithClassName(type, className) { var elm = document.createElement(type); elm.className = className; return elm; }
javascript
function createElementWithClassName(type, className) { var elm = document.createElement(type); elm.className = className; return elm; }
[ "function", "createElementWithClassName", "(", "type", ",", "className", ")", "{", "var", "elm", "=", "document", ".", "createElement", "(", "type", ")", ";", "elm", ".", "className", "=", "className", ";", "return", "elm", ";", "}" ]
Creates an element of a specified type with a specified class name. @param {string} type The node type. @param {string} className The class name to use. @return {Element} The created element.
[ "Creates", "an", "element", "of", "a", "specified", "type", "with", "a", "specified", "class", "name", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L264-L268
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
setScrollTopForDocument
function setScrollTopForDocument(doc, value) { doc.documentElement.scrollTop = doc.body.scrollTop = value; }
javascript
function setScrollTopForDocument(doc, value) { doc.documentElement.scrollTop = doc.body.scrollTop = value; }
[ "function", "setScrollTopForDocument", "(", "doc", ",", "value", ")", "{", "doc", ".", "documentElement", ".", "scrollTop", "=", "doc", ".", "body", ".", "scrollTop", "=", "value", ";", "}" ]
Alias for document.scrollTop setter. @param {!HTMLDocument} doc The document node where information will be queried from. @param {number} value The target Y scroll offset.
[ "Alias", "for", "document", ".", "scrollTop", "setter", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L315-L317
train
catapult-project/catapult
netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js
setScrollLeftForDocument
function setScrollLeftForDocument(doc, value) { doc.documentElement.scrollLeft = doc.body.scrollLeft = value; }
javascript
function setScrollLeftForDocument(doc, value) { doc.documentElement.scrollLeft = doc.body.scrollLeft = value; }
[ "function", "setScrollLeftForDocument", "(", "doc", ",", "value", ")", "{", "doc", ".", "documentElement", ".", "scrollLeft", "=", "doc", ".", "body", ".", "scrollLeft", "=", "value", ";", "}" ]
Alias for document.scrollLeft setter. @param {!HTMLDocument} doc The document node where information will be queried from. @param {number} value The target X scroll offset.
[ "Alias", "for", "document", ".", "scrollLeft", "setter", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/ui_webui_resources_js_util.js#L335-L337
train
catapult-project/catapult
tracing/third_party/oboe/src/functional.js
varArgs
function varArgs(fn){ var numberOfFixedArguments = fn.length -1, slice = Array.prototype.slice; if( numberOfFixedArguments == 0 ) { // an optimised case for when there are no fixed args: return function(){ return fn.call(this, slice.call(...
javascript
function varArgs(fn){ var numberOfFixedArguments = fn.length -1, slice = Array.prototype.slice; if( numberOfFixedArguments == 0 ) { // an optimised case for when there are no fixed args: return function(){ return fn.call(this, slice.call(...
[ "function", "varArgs", "(", "fn", ")", "{", "var", "numberOfFixedArguments", "=", "fn", ".", "length", "-", "1", ",", "slice", "=", "Array", ".", "prototype", ".", "slice", ";", "if", "(", "numberOfFixedArguments", "==", "0", ")", "{", "// an optimised cas...
Define variable argument functions but cut out all that tedious messing about with the arguments object. Delivers the variable-length part of the arguments list as an array. Eg: var myFunction = varArgs( function( fixedArgument, otherFixedArgument, variableNumberOfArguments ){ console.log( variableNumberOfArguments )...
[ "Define", "variable", "argument", "functions", "but", "cut", "out", "all", "that", "tedious", "messing", "about", "with", "the", "arguments", "object", ".", "Delivers", "the", "variable", "-", "length", "part", "of", "the", "arguments", "list", "as", "an", "...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/functional.js#L158-L197
train
catapult-project/catapult
tracing/third_party/oboe/src/ascentManager.js
ascentManager
function ascentManager(oboeBus, handlers){ "use strict"; var listenerId = {}, ascent; function stateAfter(handler) { return function(param){ ascent = handler( ascent, param); } } for( var eventName in handlers ) { oboeBus(eventName).on(stateAfter(handlers[event...
javascript
function ascentManager(oboeBus, handlers){ "use strict"; var listenerId = {}, ascent; function stateAfter(handler) { return function(param){ ascent = handler( ascent, param); } } for( var eventName in handlers ) { oboeBus(eventName).on(stateAfter(handlers[event...
[ "function", "ascentManager", "(", "oboeBus", ",", "handlers", ")", "{", "\"use strict\"", ";", "var", "listenerId", "=", "{", "}", ",", "ascent", ";", "function", "stateAfter", "(", "handler", ")", "{", "return", "function", "(", "param", ")", "{", "ascent...
A bridge used to assign stateless functions to listen to clarinet. As well as the parameter from clarinet, each callback will also be passed the result of the last callback. This may also be used to clear all listeners by assigning zero handlers: ascentManager( clarinet, {} )
[ "A", "bridge", "used", "to", "assign", "stateless", "functions", "to", "listen", "to", "clarinet", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/ascentManager.js#L12-L62
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/utils/gestures.js
PASSIVE_TOUCH
function PASSIVE_TOUCH(eventName) { if (isMouseEvent(eventName) || eventName === 'touchend') { return; } if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && passiveTouchGestures) { return {passive: true}; } else { return; } }
javascript
function PASSIVE_TOUCH(eventName) { if (isMouseEvent(eventName) || eventName === 'touchend') { return; } if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && passiveTouchGestures) { return {passive: true}; } else { return; } }
[ "function", "PASSIVE_TOUCH", "(", "eventName", ")", "{", "if", "(", "isMouseEvent", "(", "eventName", ")", "||", "eventName", "===", "'touchend'", ")", "{", "return", ";", "}", "if", "(", "HAS_NATIVE_TA", "&&", "SUPPORTS_PASSIVE", "&&", "passiveTouchGestures", ...
Generate settings for event listeners, dependant on `passiveTouchGestures` @param {string} eventName Event name to determine if `{passive}` option is needed @return {{passive: boolean} | undefined} Options to use for addEventListener and removeEventListener
[ "Generate", "settings", "for", "event", "listeners", "dependant", "on", "passiveTouchGestures" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/utils/gestures.js#L67-L76
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/utils/gestures.js
_add
function _add(node, evType, handler) { let recognizer = gestures[evType]; let deps = recognizer.deps; let name = recognizer.name; let gobj = node[GESTURE_KEY]; if (!gobj) { node[GESTURE_KEY] = gobj = {}; } for (let i = 0, dep, gd; i < deps.length; i++) { dep = deps[i]; // don't add mouse handl...
javascript
function _add(node, evType, handler) { let recognizer = gestures[evType]; let deps = recognizer.deps; let name = recognizer.name; let gobj = node[GESTURE_KEY]; if (!gobj) { node[GESTURE_KEY] = gobj = {}; } for (let i = 0, dep, gd; i < deps.length; i++) { dep = deps[i]; // don't add mouse handl...
[ "function", "_add", "(", "node", ",", "evType", ",", "handler", ")", "{", "let", "recognizer", "=", "gestures", "[", "evType", "]", ";", "let", "deps", "=", "recognizer", ".", "deps", ";", "let", "name", "=", "recognizer", ".", "name", ";", "let", "g...
automate the event listeners for the native events @private @param {!HTMLElement} node Node on which to add the event. @param {string} evType Event type to add. @param {function(!Event)} handler Event handler function. @return {void} @this {Gestures}
[ "automate", "the", "event", "listeners", "for", "the", "native", "events" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/utils/gestures.js#L539-L567
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/utils/gestures.js
_remove
function _remove(node, evType, handler) { let recognizer = gestures[evType]; let deps = recognizer.deps; let name = recognizer.name; let gobj = node[GESTURE_KEY]; if (gobj) { for (let i = 0, dep, gd; i < deps.length; i++) { dep = deps[i]; gd = gobj[dep]; if (gd && gd[name]) { gd[...
javascript
function _remove(node, evType, handler) { let recognizer = gestures[evType]; let deps = recognizer.deps; let name = recognizer.name; let gobj = node[GESTURE_KEY]; if (gobj) { for (let i = 0, dep, gd; i < deps.length; i++) { dep = deps[i]; gd = gobj[dep]; if (gd && gd[name]) { gd[...
[ "function", "_remove", "(", "node", ",", "evType", ",", "handler", ")", "{", "let", "recognizer", "=", "gestures", "[", "evType", "]", ";", "let", "deps", "=", "recognizer", ".", "deps", ";", "let", "name", "=", "recognizer", ".", "name", ";", "let", ...
automate event listener removal for native events @private @param {!HTMLElement} node Node on which to remove the event. @param {string} evType Event type to remove. @param {function(Event?)} handler Event handler function. @return {void} @this {Gestures}
[ "automate", "event", "listener", "removal", "for", "native", "events" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/utils/gestures.js#L579-L598
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/utils/gestures.js
_fire
function _fire(target, type, detail) { let ev = new Event(type, { bubbles: true, cancelable: true, composed: true }); ev.detail = detail; target.dispatchEvent(ev); // forward `preventDefault` in a clean way if (ev.defaultPrevented) { let preventer = detail.preventer || detail.sourceEvent; if (prevente...
javascript
function _fire(target, type, detail) { let ev = new Event(type, { bubbles: true, cancelable: true, composed: true }); ev.detail = detail; target.dispatchEvent(ev); // forward `preventDefault` in a clean way if (ev.defaultPrevented) { let preventer = detail.preventer || detail.sourceEvent; if (prevente...
[ "function", "_fire", "(", "target", ",", "type", ",", "detail", ")", "{", "let", "ev", "=", "new", "Event", "(", "type", ",", "{", "bubbles", ":", "true", ",", "cancelable", ":", "true", ",", "composed", ":", "true", "}", ")", ";", "ev", ".", "de...
Dispatches an event on the `target` element of `type` with the given `detail`. @private @param {!EventTarget} target The element on which to fire an event. @param {string} type The type of event to fire. @param {!Object=} detail The detail object to populate on the event. @return {void}
[ "Dispatches", "an", "event", "on", "the", "target", "element", "of", "type", "with", "the", "given", "detail", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/utils/gestures.js#L666-L677
train
catapult-project/catapult
tracing/third_party/oboe/src/pubSub.js
pubSub
function pubSub(){ var singles = {}, newListener = newSingle('newListener'), removeListener = newSingle('removeListener'); function newSingle(eventName) { return singles[eventName] = singleEventPubSub( eventName, newListener, removeListener ); } /** pu...
javascript
function pubSub(){ var singles = {}, newListener = newSingle('newListener'), removeListener = newSingle('removeListener'); function newSingle(eventName) { return singles[eventName] = singleEventPubSub( eventName, newListener, removeListener ); } /** pu...
[ "function", "pubSub", "(", ")", "{", "var", "singles", "=", "{", "}", ",", "newListener", "=", "newSingle", "(", "'newListener'", ")", ",", "removeListener", "=", "newSingle", "(", "'removeListener'", ")", ";", "function", "newSingle", "(", "eventName", ")",...
pubSub is a curried interface for listening to and emitting events. If we get a bus: var bus = pubSub(); We can listen to event 'foo' like: bus('foo').on(myCallback) And emit event foo like: bus('foo').emit() or, with a parameter: bus('foo').emit('bar') All functions can be cached and don't need to be bound. I...
[ "pubSub", "is", "a", "curried", "interface", "for", "listening", "to", "and", "emitting", "events", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/pubSub.js#L35-L64
train
catapult-project/catapult
tracing/third_party/oboe/src/lists.js
listAsArray
function listAsArray(list){ return foldR( function(arraySoFar, listItem){ arraySoFar.unshift(listItem); return arraySoFar; }, [], list ); }
javascript
function listAsArray(list){ return foldR( function(arraySoFar, listItem){ arraySoFar.unshift(listItem); return arraySoFar; }, [], list ); }
[ "function", "listAsArray", "(", "list", ")", "{", "return", "foldR", "(", "function", "(", "arraySoFar", ",", "listItem", ")", "{", "arraySoFar", ".", "unshift", "(", "listItem", ")", ";", "return", "arraySoFar", ";", "}", ",", "[", "]", ",", "list", "...
Convert a list back to a js native array
[ "Convert", "a", "list", "back", "to", "a", "js", "native", "array" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L75-L84
train
catapult-project/catapult
tracing/third_party/oboe/src/lists.js
map
function map(fn, list) { return list ? cons(fn(head(list)), map(fn,tail(list))) : emptyList ; }
javascript
function map(fn, list) { return list ? cons(fn(head(list)), map(fn,tail(list))) : emptyList ; }
[ "function", "map", "(", "fn", ",", "list", ")", "{", "return", "list", "?", "cons", "(", "fn", "(", "head", "(", "list", ")", ")", ",", "map", "(", "fn", ",", "tail", "(", "list", ")", ")", ")", ":", "emptyList", ";", "}" ]
Map a function over a list
[ "Map", "a", "function", "over", "a", "list" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L89-L95
train
catapult-project/catapult
tracing/third_party/oboe/src/lists.js
without
function without(list, test, removedFn) { return withoutInner(list, removedFn || noop); function withoutInner(subList, removedFn) { return subList ? ( test(head(subList)) ? (removedFn(head(subList)), tail(subList)) : cons(head(subList), withoutInner(tail...
javascript
function without(list, test, removedFn) { return withoutInner(list, removedFn || noop); function withoutInner(subList, removedFn) { return subList ? ( test(head(subList)) ? (removedFn(head(subList)), tail(subList)) : cons(head(subList), withoutInner(tail...
[ "function", "without", "(", "list", ",", "test", ",", "removedFn", ")", "{", "return", "withoutInner", "(", "list", ",", "removedFn", "||", "noop", ")", ";", "function", "withoutInner", "(", "subList", ",", "removedFn", ")", "{", "return", "subList", "?", ...
Return a list like the one given but with the first instance equal to item removed
[ "Return", "a", "list", "like", "the", "one", "given", "but", "with", "the", "first", "instance", "equal", "to", "item", "removed" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L128-L141
train
catapult-project/catapult
tracing/third_party/oboe/src/lists.js
all
function all(fn, list) { return !list || ( fn(head(list)) && all(fn, tail(list)) ); }
javascript
function all(fn, list) { return !list || ( fn(head(list)) && all(fn, tail(list)) ); }
[ "function", "all", "(", "fn", ",", "list", ")", "{", "return", "!", "list", "||", "(", "fn", "(", "head", "(", "list", ")", ")", "&&", "all", "(", "fn", ",", "tail", "(", "list", ")", ")", ")", ";", "}" ]
Returns true if the given function holds for every item in the list, false otherwise
[ "Returns", "true", "if", "the", "given", "function", "holds", "for", "every", "item", "in", "the", "list", "false", "otherwise" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L147-L151
train
catapult-project/catapult
tracing/third_party/oboe/src/lists.js
applyEach
function applyEach(fnList, args) { if( fnList ) { head(fnList).apply(null, args); applyEach(tail(fnList), args); } }
javascript
function applyEach(fnList, args) { if( fnList ) { head(fnList).apply(null, args); applyEach(tail(fnList), args); } }
[ "function", "applyEach", "(", "fnList", ",", "args", ")", "{", "if", "(", "fnList", ")", "{", "head", "(", "fnList", ")", ".", "apply", "(", "null", ",", "args", ")", ";", "applyEach", "(", "tail", "(", "fnList", ")", ",", "args", ")", ";", "}", ...
Call every function in a list of functions with the same arguments This doesn't make any sense if we're doing pure functional because it doesn't return anything. Hence, this is only really useful if the functions being called have side-effects.
[ "Call", "every", "function", "in", "a", "list", "of", "functions", "with", "the", "same", "arguments" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L160-L167
train
catapult-project/catapult
tracing/third_party/oboe/src/lists.js
reverseList
function reverseList(list){ // js re-implementation of 3rd solution from: // http://www.haskell.org/haskellwiki/99_questions/Solutions/5 function reverseInner( list, reversedAlready ) { if( !list ) { return reversedAlready; } return reverseInner(tail(list), cons(head(list...
javascript
function reverseList(list){ // js re-implementation of 3rd solution from: // http://www.haskell.org/haskellwiki/99_questions/Solutions/5 function reverseInner( list, reversedAlready ) { if( !list ) { return reversedAlready; } return reverseInner(tail(list), cons(head(list...
[ "function", "reverseList", "(", "list", ")", "{", "// js re-implementation of 3rd solution from:", "// http://www.haskell.org/haskellwiki/99_questions/Solutions/5", "function", "reverseInner", "(", "list", ",", "reversedAlready", ")", "{", "if", "(", "!", "list", ")", "{...
Reverse the order of a list
[ "Reverse", "the", "order", "of", "a", "list" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/lists.js#L172-L185
train
catapult-project/catapult
dashboard/dashboard/spa/alerts-section.js
handleBatch
function handleBatch(results, showingTriaged) { const alerts = []; const nextRequests = []; const triagedRequests = []; let totalCount = 0; for (const {body, response} of results) { alerts.push.apply(alerts, response.anomalies); if (body.count_limit) totalCount += response.count; const cursor = ...
javascript
function handleBatch(results, showingTriaged) { const alerts = []; const nextRequests = []; const triagedRequests = []; let totalCount = 0; for (const {body, response} of results) { alerts.push.apply(alerts, response.anomalies); if (body.count_limit) totalCount += response.count; const cursor = ...
[ "function", "handleBatch", "(", "results", ",", "showingTriaged", ")", "{", "const", "alerts", "=", "[", "]", ";", "const", "nextRequests", "=", "[", "]", ";", "const", "triagedRequests", "=", "[", "]", ";", "let", "totalCount", "=", "0", ";", "for", "...
The BatchIterator in actions.loadAlerts yielded a batch of results. Collect all alerts from all batches into `alerts`. Chase cursors in `nextRequests`. Fetch triaged alerts when a request for untriaged alerts returns.
[ "The", "BatchIterator", "in", "actions", ".", "loadAlerts", "yielded", "a", "batch", "of", "results", ".", "Collect", "all", "alerts", "from", "all", "batches", "into", "alerts", ".", "Chase", "cursors", "in", "nextRequests", ".", "Fetch", "triaged", "alerts",...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/dashboard/dashboard/spa/alerts-section.js#L291-L321
train
catapult-project/catapult
dashboard/dashboard/spa/alerts-section.js
loadMore
function loadMore(batches, alertGroups, nextRequests, triagedRequests, triagedMaxStartRevision, started) { const minStartRevision = tr.b.math.Statistics.min( alertGroups, group => tr.b.math.Statistics.min( group.alerts, a => a.startRevision)); if (!triagedMaxStartRevision || (minStartRevi...
javascript
function loadMore(batches, alertGroups, nextRequests, triagedRequests, triagedMaxStartRevision, started) { const minStartRevision = tr.b.math.Statistics.min( alertGroups, group => tr.b.math.Statistics.min( group.alerts, a => a.startRevision)); if (!triagedMaxStartRevision || (minStartRevi...
[ "function", "loadMore", "(", "batches", ",", "alertGroups", ",", "nextRequests", ",", "triagedRequests", ",", "triagedMaxStartRevision", ",", "started", ")", "{", "const", "minStartRevision", "=", "tr", ".", "b", ".", "math", ".", "Statistics", ".", "min", "("...
This function may add requests to `batches`. See handleBatch for `nextRequests` and `triagedRequests`.
[ "This", "function", "may", "add", "requests", "to", "batches", ".", "See", "handleBatch", "for", "nextRequests", "and", "triagedRequests", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/dashboard/dashboard/spa/alerts-section.js#L325-L353
train
catapult-project/catapult
tracing/third_party/oboe/src/patternAdapter.js
patternAdapter
function patternAdapter(oboeBus, jsonPathCompiler) { var predicateEventMap = { node:oboeBus(NODE_CLOSED) , path:oboeBus(NODE_OPENED) }; function emitMatchingNode(emitMatch, node, ascent) { /* We're now calling to the outside world where Lisp-style lists will...
javascript
function patternAdapter(oboeBus, jsonPathCompiler) { var predicateEventMap = { node:oboeBus(NODE_CLOSED) , path:oboeBus(NODE_OPENED) }; function emitMatchingNode(emitMatch, node, ascent) { /* We're now calling to the outside world where Lisp-style lists will...
[ "function", "patternAdapter", "(", "oboeBus", ",", "jsonPathCompiler", ")", "{", "var", "predicateEventMap", "=", "{", "node", ":", "oboeBus", "(", "NODE_CLOSED", ")", ",", "path", ":", "oboeBus", "(", "NODE_OPENED", ")", "}", ";", "function", "emitMatchingNod...
The pattern adaptor listens for newListener and removeListener events. When patterns are added or removed it compiles the JSONPath and wires them up. When nodes and paths are found it emits the fully-qualified match events with parameters ready to ship to the outside world
[ "The", "pattern", "adaptor", "listens", "for", "newListener", "and", "removeListener", "events", ".", "When", "patterns", "are", "added", "or", "removed", "it", "compiles", "the", "JSONPath", "and", "wires", "them", "up", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/patternAdapter.js#L10-L112
train
catapult-project/catapult
tracing/third_party/oboe/src/instanceApi.js
protectedCallback
function protectedCallback( callback ) { return function() { try{ return callback.apply(oboeApi, arguments); }catch(e) { setTimeout(function() { throw new Error(e.message); }); } } }
javascript
function protectedCallback( callback ) { return function() { try{ return callback.apply(oboeApi, arguments); }catch(e) { setTimeout(function() { throw new Error(e.message); }); } } }
[ "function", "protectedCallback", "(", "callback", ")", "{", "return", "function", "(", ")", "{", "try", "{", "return", "callback", ".", "apply", "(", "oboeApi", ",", "arguments", ")", ";", "}", "catch", "(", "e", ")", "{", "setTimeout", "(", "function", ...
wrap a callback so that if it throws, Oboe.js doesn't crash but instead throw the error in another event loop
[ "wrap", "a", "callback", "so", "that", "if", "it", "throws", "Oboe", ".", "js", "doesn", "t", "crash", "but", "instead", "throw", "the", "error", "in", "another", "event", "loop" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/instanceApi.js#L126-L136
train
catapult-project/catapult
tracing/third_party/oboe/src/instanceApi.js
addMultipleNodeOrPathListeners
function addMultipleNodeOrPathListeners(eventId, listenerMap) { for( var pattern in listenerMap ) { addSingleNodeOrPathListener(eventId, pattern, listenerMap[pattern]); } }
javascript
function addMultipleNodeOrPathListeners(eventId, listenerMap) { for( var pattern in listenerMap ) { addSingleNodeOrPathListener(eventId, pattern, listenerMap[pattern]); } }
[ "function", "addMultipleNodeOrPathListeners", "(", "eventId", ",", "listenerMap", ")", "{", "for", "(", "var", "pattern", "in", "listenerMap", ")", "{", "addSingleNodeOrPathListener", "(", "eventId", ",", "pattern", ",", "listenerMap", "[", "pattern", "]", ")", ...
Add several listeners at a time, from a map
[ "Add", "several", "listeners", "at", "a", "time", "from", "a", "map" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/instanceApi.js#L183-L188
train
catapult-project/catapult
third_party/polymer2/bower_components/web-animations-js/src/handler-utils.js
consumeParenthesised
function consumeParenthesised(parser, string) { var nesting = 0; for (var n = 0; n < string.length; n++) { if (/\s|,/.test(string[n]) && nesting == 0) { break; } else if (string[n] == '(') { nesting++; } else if (string[n] == ')') { nesting--; if (nesting == 0) ...
javascript
function consumeParenthesised(parser, string) { var nesting = 0; for (var n = 0; n < string.length; n++) { if (/\s|,/.test(string[n]) && nesting == 0) { break; } else if (string[n] == '(') { nesting++; } else if (string[n] == ')') { nesting--; if (nesting == 0) ...
[ "function", "consumeParenthesised", "(", "parser", ",", "string", ")", "{", "var", "nesting", "=", "0", ";", "for", "(", "var", "n", "=", "0", ";", "n", "<", "string", ".", "length", ";", "n", "++", ")", "{", "if", "(", "/", "\\s|,", "/", ".", ...
Consumes a token or expression with balanced parentheses
[ "Consumes", "a", "token", "or", "expression", "with", "balanced", "parentheses" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer2/bower_components/web-animations-js/src/handler-utils.js#L55-L72
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
doScrollCheck
function doScrollCheck() { if ( jQuery.isReady ) { return; } try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch(e) { setTimeout( doScrollCheck, 1 ); return; } // and execute any waiting functions j...
javascript
function doScrollCheck() { if ( jQuery.isReady ) { return; } try { // If IE is used, use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ document.documentElement.doScroll("left"); } catch(e) { setTimeout( doScrollCheck, 1 ); return; } // and execute any waiting functions j...
[ "function", "doScrollCheck", "(", ")", "{", "if", "(", "jQuery", ".", "isReady", ")", "{", "return", ";", "}", "try", "{", "// If IE is used, use the trick by Diego Perini", "// http://javascript.nwbox.com/IEContentLoaded/", "document", ".", "documentElement", ".", "doS...
The DOM ready check for Internet Explorer
[ "The", "DOM", "ready", "check", "for", "Internet", "Explorer" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L937-L953
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
createFlags
function createFlags( flags ) { var object = flagsCache[ flags ] = {}, i, length; flags = flags.split( /\s+/ ); for ( i = 0, length = flags.length; i < length; i++ ) { object[ flags[i] ] = true; } return object; }
javascript
function createFlags( flags ) { var object = flagsCache[ flags ] = {}, i, length; flags = flags.split( /\s+/ ); for ( i = 0, length = flags.length; i < length; i++ ) { object[ flags[i] ] = true; } return object; }
[ "function", "createFlags", "(", "flags", ")", "{", "var", "object", "=", "flagsCache", "[", "flags", "]", "=", "{", "}", ",", "i", ",", "length", ";", "flags", "=", "flags", ".", "split", "(", "/", "\\s+", "/", ")", ";", "for", "(", "i", "=", "...
Convert String-formatted flags into Object-formatted ones and store in cache
[ "Convert", "String", "-", "formatted", "flags", "into", "Object", "-", "formatted", "ones", "and", "store", "in", "cache" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L964-L972
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
function( obj ) { if ( obj == null ) { obj = promise; } else { for ( var key in promise ) { obj[ key ] = promise[ key ]; } } return obj; }
javascript
function( obj ) { if ( obj == null ) { obj = promise; } else { for ( var key in promise ) { obj[ key ] = promise[ key ]; } } return obj; }
[ "function", "(", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "obj", "=", "promise", ";", "}", "else", "{", "for", "(", "var", "key", "in", "promise", ")", "{", "obj", "[", "key", "]", "=", "promise", "[", "key", "]", ";", "}", ...
Get a promise for this deferred If obj is provided, the promise aspect is added to the object
[ "Get", "a", "promise", "for", "this", "deferred", "If", "obj", "is", "provided", "the", "promise", "aspect", "is", "added", "to", "the", "object" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L1249-L1258
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
isEmptyDataObject
function isEmptyDataObject( obj ) { for ( var name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; }
javascript
function isEmptyDataObject( obj ) { for ( var name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; }
[ "function", "isEmptyDataObject", "(", "obj", ")", "{", "for", "(", "var", "name", "in", "obj", ")", "{", "// if the public data object is empty, the private is still empty", "if", "(", "name", "===", "\"data\"", "&&", "jQuery", ".", "isEmptyObject", "(", "obj", "[...
checks a cache object for emptiness
[ "checks", "a", "cache", "object", "for", "emptiness" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L1962-L1975
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
fixDefaultChecked
function fixDefaultChecked( elem ) { if ( elem.type === "checkbox" || elem.type === "radio" ) { elem.defaultChecked = elem.checked; } }
javascript
function fixDefaultChecked( elem ) { if ( elem.type === "checkbox" || elem.type === "radio" ) { elem.defaultChecked = elem.checked; } }
[ "function", "fixDefaultChecked", "(", "elem", ")", "{", "if", "(", "elem", ".", "type", "===", "\"checkbox\"", "||", "elem", ".", "type", "===", "\"radio\"", ")", "{", "elem", ".", "defaultChecked", "=", "elem", ".", "checked", ";", "}", "}" ]
Used in clean, fixes the defaultChecked property
[ "Used", "in", "clean", "fixes", "the", "defaultChecked", "property" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L6176-L6180
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
findInputs
function findInputs( elem ) { var nodeName = ( elem.nodeName || "" ).toLowerCase(); if ( nodeName === "input" ) { fixDefaultChecked( elem ); // Skip scripts, get other children } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) { jQuery.grep( elem.getElementsByTagName("input...
javascript
function findInputs( elem ) { var nodeName = ( elem.nodeName || "" ).toLowerCase(); if ( nodeName === "input" ) { fixDefaultChecked( elem ); // Skip scripts, get other children } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) { jQuery.grep( elem.getElementsByTagName("input...
[ "function", "findInputs", "(", "elem", ")", "{", "var", "nodeName", "=", "(", "elem", ".", "nodeName", "||", "\"\"", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "nodeName", "===", "\"input\"", ")", "{", "fixDefaultChecked", "(", "elem", ")", ";"...
Finds all inputs and passes them to fixDefaultChecked
[ "Finds", "all", "inputs", "and", "passes", "them", "to", "fixDefaultChecked" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L6182-L6190
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
ajaxConvert
function ajaxConvert( s, response ) { // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } var dataTypes = s.dataTypes, converters = {}, i, key, length = dataTypes.length, tmp, // Current and previous dataTypes current = dataTypes[ 0 ], pre...
javascript
function ajaxConvert( s, response ) { // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } var dataTypes = s.dataTypes, converters = {}, i, key, length = dataTypes.length, tmp, // Current and previous dataTypes current = dataTypes[ 0 ], pre...
[ "function", "ajaxConvert", "(", "s", ",", "response", ")", "{", "// Apply the dataFilter if provided", "if", "(", "s", ".", "dataFilter", ")", "{", "response", "=", "s", ".", "dataFilter", "(", "response", ",", "s", ".", "dataType", ")", ";", "}", "var", ...
Chain conversions given the request and the original response
[ "Chain", "conversions", "given", "the", "request", "and", "the", "original", "response" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js#L7745-L7827
train
catapult-project/catapult
telemetry/telemetry/internal/actions/media_action.js
onError
function onError(e) { window.__error = 'Media error: ' + e.type + ', code:' + e.target.error.code; throw new Error(window.__error); }
javascript
function onError(e) { window.__error = 'Media error: ' + e.type + ', code:' + e.target.error.code; throw new Error(window.__error); }
[ "function", "onError", "(", "e", ")", "{", "window", ".", "__error", "=", "'Media error: '", "+", "e", ".", "type", "+", "', code:'", "+", "e", ".", "target", ".", "error", ".", "code", ";", "throw", "new", "Error", "(", "window", ".", "__error", ")"...
Listens to HTML5 media errors.
[ "Listens", "to", "HTML5", "media", "errors", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/telemetry/telemetry/internal/actions/media_action.js#L42-L45
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/markermanager.js
GridBounds
function GridBounds(bounds) { // [sw, ne] this.minX = Math.min(bounds[0].x, bounds[1].x); this.maxX = Math.max(bounds[0].x, bounds[1].x); this.minY = Math.min(bounds[0].y, bounds[1].y); this.maxY = Math.max(bounds[0].y, bounds[1].y); }
javascript
function GridBounds(bounds) { // [sw, ne] this.minX = Math.min(bounds[0].x, bounds[1].x); this.maxX = Math.max(bounds[0].x, bounds[1].x); this.minY = Math.min(bounds[0].y, bounds[1].y); this.maxY = Math.max(bounds[0].y, bounds[1].y); }
[ "function", "GridBounds", "(", "bounds", ")", "{", "// [sw, ne]", "this", ".", "minX", "=", "Math", ".", "min", "(", "bounds", "[", "0", "]", ".", "x", ",", "bounds", "[", "1", "]", ".", "x", ")", ";", "this", ".", "maxX", "=", "Math", ".", "ma...
Helper class to create a bounds of INT ranges. @param bounds Array.<Object.<string, number>> Bounds object. @constructor
[ "Helper", "class", "to", "create", "a", "bounds", "of", "INT", "ranges", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/markermanager.js#L485-L493
train
catapult-project/catapult
common/py_vulcanize/third_party/rjsmin/bench/markermanager.js
ProjectionHelperOverlay
function ProjectionHelperOverlay(map) { this.setMap(map); var TILEFACTOR = 8; var TILESIDE = 1 << TILEFACTOR; var RADIUS = 7; this._map = map; this._zoom = -1; this._X0 = this._Y0 = this._X1 = this._Y1 = -1; }
javascript
function ProjectionHelperOverlay(map) { this.setMap(map); var TILEFACTOR = 8; var TILESIDE = 1 << TILEFACTOR; var RADIUS = 7; this._map = map; this._zoom = -1; this._X0 = this._Y0 = this._X1 = this._Y1 = -1; }
[ "function", "ProjectionHelperOverlay", "(", "map", ")", "{", "this", ".", "setMap", "(", "map", ")", ";", "var", "TILEFACTOR", "=", "8", ";", "var", "TILESIDE", "=", "1", "<<", "TILEFACTOR", ";", "var", "RADIUS", "=", "7", ";", "this", ".", "_map", "...
Projection overlay helper. Helps in calculating that markers get into the right grid. @constructor @param {Map} map The map to manage.
[ "Projection", "overlay", "helper", ".", "Helps", "in", "calculating", "that", "markers", "get", "into", "the", "right", "grid", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/common/py_vulcanize/third_party/rjsmin/bench/markermanager.js#L912-L928
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
hasAllProperties
function hasAllProperties(fieldList, o) { return (o instanceof Object) && all(function (field) { return (field in o); }, fieldList); }
javascript
function hasAllProperties(fieldList, o) { return (o instanceof Object) && all(function (field) { return (field in o); }, fieldList); }
[ "function", "hasAllProperties", "(", "fieldList", ",", "o", ")", "{", "return", "(", "o", "instanceof", "Object", ")", "&&", "all", "(", "function", "(", "field", ")", "{", "return", "(", "field", "in", "o", ")", ";", "}", ",", "fieldList", ")", ";",...
Returns true if object o has a key named like every property in the properties array. Will give false if any are missing, or if o is not an object.
[ "Returns", "true", "if", "object", "o", "has", "a", "key", "named", "like", "every", "property", "in", "the", "properties", "array", ".", "Will", "give", "false", "if", "any", "are", "missing", "or", "if", "o", "is", "not", "an", "object", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L326-L333
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
incrementalContentBuilder
function incrementalContentBuilder( oboeBus ) { var emitNodeOpened = oboeBus(NODE_OPENED).emit, emitNodeClosed = oboeBus(NODE_CLOSED).emit, emitRootOpened = oboeBus(ROOT_PATH_FOUND).emit, emitRootClosed = oboeBus(ROOT_NODE_FOUND).emit; function arrayIndicesAreKeys( possiblyInconsistentAscen...
javascript
function incrementalContentBuilder( oboeBus ) { var emitNodeOpened = oboeBus(NODE_OPENED).emit, emitNodeClosed = oboeBus(NODE_CLOSED).emit, emitRootOpened = oboeBus(ROOT_PATH_FOUND).emit, emitRootClosed = oboeBus(ROOT_NODE_FOUND).emit; function arrayIndicesAreKeys( possiblyInconsistentAscen...
[ "function", "incrementalContentBuilder", "(", "oboeBus", ")", "{", "var", "emitNodeOpened", "=", "oboeBus", "(", "NODE_OPENED", ")", ".", "emit", ",", "emitNodeClosed", "=", "oboeBus", "(", "NODE_CLOSED", ")", ".", "emit", ",", "emitRootOpened", "=", "oboeBus", ...
Create a new set of handlers for clarinet's events, bound to the emit function given.
[ "Create", "a", "new", "set", "of", "handlers", "for", "clarinet", "s", "events", "bound", "to", "the", "emit", "function", "given", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L1390-L1507
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
keyFound
function keyFound(ascent, newDeepestName, maybeNewDeepestNode) { if( ascent ) { // if not root // If we have the key but (unless adding to an array) no known value // yet. Put that key in the output but against no defined value: appendBuiltContent( ascent, newDeepestName, ...
javascript
function keyFound(ascent, newDeepestName, maybeNewDeepestNode) { if( ascent ) { // if not root // If we have the key but (unless adding to an array) no known value // yet. Put that key in the output but against no defined value: appendBuiltContent( ascent, newDeepestName, ...
[ "function", "keyFound", "(", "ascent", ",", "newDeepestName", ",", "maybeNewDeepestNode", ")", "{", "if", "(", "ascent", ")", "{", "// if not root", "// If we have the key but (unless adding to an array) no known value", "// yet. Put that key in the output but against no defined va...
For when we find a new key in the json. @param {String|Number|Object} newDeepestName the key. If we are in an array will be a number, otherwise a string. May take the special value ROOT_PATH if the root node has just been found @param {String|Number|Object|Array|Null|undefined} [maybeNewDeepestNode] usually this won'...
[ "For", "when", "we", "find", "a", "new", "key", "in", "the", "json", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L1468-L1486
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
nodeClosed
function nodeClosed( ascent ) { emitNodeClosed( ascent); return tail( ascent) || // If there are no nodes left in the ascent the root node // just closed. Emit a special event for this: emitRootClosed(nodeOf(head(ascent))); }
javascript
function nodeClosed( ascent ) { emitNodeClosed( ascent); return tail( ascent) || // If there are no nodes left in the ascent the root node // just closed. Emit a special event for this: emitRootClosed(nodeOf(head(ascent))); }
[ "function", "nodeClosed", "(", "ascent", ")", "{", "emitNodeClosed", "(", "ascent", ")", ";", "return", "tail", "(", "ascent", ")", "||", "// If there are no nodes left in the ascent the root node", "// just closed. Emit a special event for this: ", "emitRootClosed", "(", "...
For when the current node ends.
[ "For", "when", "the", "current", "node", "ends", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L1492-L1500
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
skip1
function skip1(previousExpr) { if( previousExpr == always ) { /* If there is no previous expression this consume command is at the start of the jsonPath. Since JSONPath specifies what we'd like to find but not necessarily everything leading down to it, when r...
javascript
function skip1(previousExpr) { if( previousExpr == always ) { /* If there is no previous expression this consume command is at the start of the jsonPath. Since JSONPath specifies what we'd like to find but not necessarily everything leading down to it, when r...
[ "function", "skip1", "(", "previousExpr", ")", "{", "if", "(", "previousExpr", "==", "always", ")", "{", "/* If there is no previous expression this consume command \n is at the start of the jsonPath.\n Since JSONPath specifies what we'd like to find but not \n ...
Create an evaluator function that moves onto the next item on the lists. This function is the place where the logic to move up a level in the ascent exists. Eg, for JSONPath ".foo" we need skip1(nameClause(always, [,'foo']))
[ "Create", "an", "evaluator", "function", "that", "moves", "onto", "the", "next", "item", "on", "the", "lists", ".", "This", "function", "is", "the", "place", "where", "the", "logic", "to", "move", "up", "a", "level", "in", "the", "ascent", "exists", "." ...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L1604-L1639
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
statementExpr
function statementExpr(lastClause) { return function(ascent) { // kick off the evaluation by passing through to the last clause var exprMatch = lastClause(ascent); return exprMatch === true ? head(ascent) : exprMatch; ...
javascript
function statementExpr(lastClause) { return function(ascent) { // kick off the evaluation by passing through to the last clause var exprMatch = lastClause(ascent); return exprMatch === true ? head(ascent) : exprMatch; ...
[ "function", "statementExpr", "(", "lastClause", ")", "{", "return", "function", "(", "ascent", ")", "{", "// kick off the evaluation by passing through to the last clause", "var", "exprMatch", "=", "lastClause", "(", "ascent", ")", ";", "return", "exprMatch", "===", "...
Generate a statement wrapper to sit around the outermost clause evaluator. Handles the case where the capturing is implicit because the JSONPath did not contain a '$' by returning the last node.
[ "Generate", "a", "statement", "wrapper", "to", "sit", "around", "the", "outermost", "clause", "evaluator", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L1694-L1703
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
expressionsReader
function expressionsReader( exprs, parserGeneratedSoFar, detection ) { // if exprs is zero-length foldR will pass back the // parserGeneratedSoFar as-is so we don't need to treat // this as a special case return foldR( function( parserGenerated...
javascript
function expressionsReader( exprs, parserGeneratedSoFar, detection ) { // if exprs is zero-length foldR will pass back the // parserGeneratedSoFar as-is so we don't need to treat // this as a special case return foldR( function( parserGenerated...
[ "function", "expressionsReader", "(", "exprs", ",", "parserGeneratedSoFar", ",", "detection", ")", "{", "// if exprs is zero-length foldR will pass back the ", "// parserGeneratedSoFar as-is so we don't need to treat ", "// this as a special case", "return", "foldR", "(", "function",...
For when a token has been found in the JSONPath input. Compiles the parser for that token and returns in combination with the parser already generated. @param {Function} exprs a list of the clause evaluator generators for the token that was found @param {Function} parserGeneratedSoFar the parser already found @param ...
[ "For", "when", "a", "token", "has", "been", "found", "in", "the", "JSONPath", "input", ".", "Compiles", "the", "parser", "for", "that", "token", "and", "returns", "in", "combination", "with", "the", "parser", "already", "generated", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L1716-L1731
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
generateClauseReaderIfTokenFound
function generateClauseReaderIfTokenFound ( tokenDetector, clauseEvaluatorGenerators, jsonPath, parserGeneratedSoFar, onSuccess) { var detected = tokenDetector(jsonPath); if(detected) { var com...
javascript
function generateClauseReaderIfTokenFound ( tokenDetector, clauseEvaluatorGenerators, jsonPath, parserGeneratedSoFar, onSuccess) { var detected = tokenDetector(jsonPath); if(detected) { var com...
[ "function", "generateClauseReaderIfTokenFound", "(", "tokenDetector", ",", "clauseEvaluatorGenerators", ",", "jsonPath", ",", "parserGeneratedSoFar", ",", "onSuccess", ")", "{", "var", "detected", "=", "tokenDetector", "(", "jsonPath", ")", ";", "if", "(", "detected",...
If jsonPath matches the given detector function, creates a function which evaluates against every clause in the clauseEvaluatorGenerators. The created function is propagated to the onSuccess function, along with the remaining unparsed JSONPath substring. The intended use is to create a clauseMatcher by filling in the ...
[ "If", "jsonPath", "matches", "the", "given", "detector", "function", "creates", "a", "function", "which", "evaluates", "against", "every", "clause", "in", "the", "clauseEvaluatorGenerators", ".", "The", "created", "function", "is", "propagated", "to", "the", "onSu...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L1749-L1768
train
catapult-project/catapult
tracing/third_party/oboe/dist/oboe-node.js
compileJsonPathToFunction
function compileJsonPathToFunction( uncompiledJsonPath, parserGeneratedSoFar ) { /** * On finding a match, if there is remaining text to be compiled * we want to either continue parsing using a recursive call to * compileJsonPathToFunction. Otherwise,...
javascript
function compileJsonPathToFunction( uncompiledJsonPath, parserGeneratedSoFar ) { /** * On finding a match, if there is remaining text to be compiled * we want to either continue parsing using a recursive call to * compileJsonPathToFunction. Otherwise,...
[ "function", "compileJsonPathToFunction", "(", "uncompiledJsonPath", ",", "parserGeneratedSoFar", ")", "{", "/**\n * On finding a match, if there is remaining text to be compiled\n * we want to either continue parsing using a recursive call to \n * compileJsonPathToFunction. Otherwi...
Recursively compile a JSONPath expression. This function serves as one of two possible values for the onSuccess argument of generateClauseReaderIfTokenFound, meaning continue to recursively compile. Otherwise, returnFoundParser is given and compilation terminates.
[ "Recursively", "compile", "a", "JSONPath", "expression", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/dist/oboe-node.js#L1836-L1854
train
catapult-project/catapult
third_party/vinn/third_party/parse5/lib/tree_construction/parser.js
callAdoptionAgency
function callAdoptionAgency(p, token) { for (var i = 0; i < AA_OUTER_LOOP_ITER; i++) { var formattingElementEntry = aaObtainFormattingElementEntry(p, token, formattingElementEntry); if (!formattingElementEntry) break; var furthestBlock = aaObtainFurthestBlock(p, formattingEleme...
javascript
function callAdoptionAgency(p, token) { for (var i = 0; i < AA_OUTER_LOOP_ITER; i++) { var formattingElementEntry = aaObtainFormattingElementEntry(p, token, formattingElementEntry); if (!formattingElementEntry) break; var furthestBlock = aaObtainFurthestBlock(p, formattingEleme...
[ "function", "callAdoptionAgency", "(", "p", ",", "token", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "AA_OUTER_LOOP_ITER", ";", "i", "++", ")", "{", "var", "formattingElementEntry", "=", "aaObtainFormattingElementEntry", "(", "p", ",", "tok...
Algorithm entry point
[ "Algorithm", "entry", "point" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/vinn/third_party/parse5/lib/tree_construction/parser.js#L1002-L1023
train
catapult-project/catapult
experimental/v8_tools/filter.js
readSingleFile
function readSingleFile(e) { const file = e.target.files[0]; if (!file) { return; } // Extract data from file and distribute it in some relevant structures: // results for all guid-related( for now they are not // divided in 3 parts depending on the type ) and // all results with sample-value-rela...
javascript
function readSingleFile(e) { const file = e.target.files[0]; if (!file) { return; } // Extract data from file and distribute it in some relevant structures: // results for all guid-related( for now they are not // divided in 3 parts depending on the type ) and // all results with sample-value-rela...
[ "function", "readSingleFile", "(", "e", ")", "{", "const", "file", "=", "e", ".", "target", ".", "files", "[", "0", "]", ";", "if", "(", "!", "file", ")", "{", "return", ";", "}", "// Extract data from file and distribute it in some relevant structures:", "//...
Load the content of the file and further display the data.
[ "Load", "the", "content", "of", "the", "file", "and", "further", "display", "the", "data", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/experimental/v8_tools/filter.js#L296-L380
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/template-stamp.js
applyTemplateContent
function applyTemplateContent(inst, node, nodeInfo) { if (nodeInfo.templateInfo) { node._templateInfo = nodeInfo.templateInfo; } }
javascript
function applyTemplateContent(inst, node, nodeInfo) { if (nodeInfo.templateInfo) { node._templateInfo = nodeInfo.templateInfo; } }
[ "function", "applyTemplateContent", "(", "inst", ",", "node", ",", "nodeInfo", ")", "{", "if", "(", "nodeInfo", ".", "templateInfo", ")", "{", "node", ".", "_templateInfo", "=", "nodeInfo", ".", "templateInfo", ";", "}", "}" ]
push configuration references at configure time
[ "push", "configuration", "references", "at", "configure", "time" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/template-stamp.js#L75-L79
train
catapult-project/catapult
tracing/third_party/oboe/src/detectCrossOrigin.browser.js
isCrossOrigin
function isCrossOrigin(pageLocation, ajaxHost) { /* * NB: defaultPort only knows http and https. * Returns undefined otherwise. */ function defaultPort(protocol) { return {'http:':80, 'https:':443}[protocol]; } function portOf(location) { // pageLocation should always have a pro...
javascript
function isCrossOrigin(pageLocation, ajaxHost) { /* * NB: defaultPort only knows http and https. * Returns undefined otherwise. */ function defaultPort(protocol) { return {'http:':80, 'https:':443}[protocol]; } function portOf(location) { // pageLocation should always have a pro...
[ "function", "isCrossOrigin", "(", "pageLocation", ",", "ajaxHost", ")", "{", "/*\n * NB: defaultPort only knows http and https.\n * Returns undefined otherwise.\n */", "function", "defaultPort", "(", "protocol", ")", "{", "return", "{", "'http:'", ":", "80", ",", "...
Detect if a given URL is cross-origin in the scope of the current page. Browser only (since cross-origin has no meaning in Node.js) @param {Object} pageLocation - as in window.location @param {Object} ajaxHost - an object like window.location describing the origin of the url that we want to ajax in
[ "Detect", "if", "a", "given", "URL", "is", "cross", "-", "origin", "in", "the", "scope", "of", "the", "current", "page", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/tracing/third_party/oboe/src/detectCrossOrigin.browser.js#L11-L36
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
ensureOwnEffectMap
function ensureOwnEffectMap(model, type) { let effects = model[type]; if (!effects) { effects = model[type] = {}; } else if (!model.hasOwnProperty(type)) { effects = model[type] = Object.create(model[type]); for (let p in effects) { let protoFx = effects[p]; let instFx = effects[p] = Array...
javascript
function ensureOwnEffectMap(model, type) { let effects = model[type]; if (!effects) { effects = model[type] = {}; } else if (!model.hasOwnProperty(type)) { effects = model[type] = Object.create(model[type]); for (let p in effects) { let protoFx = effects[p]; let instFx = effects[p] = Array...
[ "function", "ensureOwnEffectMap", "(", "model", ",", "type", ")", "{", "let", "effects", "=", "model", "[", "type", "]", ";", "if", "(", "!", "effects", ")", "{", "effects", "=", "model", "[", "type", "]", "=", "{", "}", ";", "}", "else", "if", "...
eslint-disable-line no-unused-vars Ensures that the model has an own-property map of effects for the given type. The model may be a prototype or an instance. Property effects are stored as arrays of effects by property in a map, by named type on the model. e.g. __computeEffects: { foo: [ ... ], bar: [ ... ] } If th...
[ "eslint", "-", "disable", "-", "line", "no", "-", "unused", "-", "vars", "Ensures", "that", "the", "model", "has", "an", "own", "-", "property", "map", "of", "effects", "for", "the", "given", "type", ".", "The", "model", "may", "be", "a", "prototype", ...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L88-L103
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
runEffectsForProperty
function runEffectsForProperty(inst, effects, dedupeId, prop, props, oldProps, hasPaths, extraArgs) { let ran = false; let rootProperty = hasPaths ? root$0(prop) : prop; let fxs = effects[rootProperty]; if (fxs) { for (let i=0, l=fxs.length, fx; (i<l) && (fx=fxs[i]); i++) { if ((!fx.info || fx.info.la...
javascript
function runEffectsForProperty(inst, effects, dedupeId, prop, props, oldProps, hasPaths, extraArgs) { let ran = false; let rootProperty = hasPaths ? root$0(prop) : prop; let fxs = effects[rootProperty]; if (fxs) { for (let i=0, l=fxs.length, fx; (i<l) && (fx=fxs[i]); i++) { if ((!fx.info || fx.info.la...
[ "function", "runEffectsForProperty", "(", "inst", ",", "effects", ",", "dedupeId", ",", "prop", ",", "props", ",", "oldProps", ",", "hasPaths", ",", "extraArgs", ")", "{", "let", "ran", "=", "false", ";", "let", "rootProperty", "=", "hasPaths", "?", "root$...
Runs a list of effects for a given property. @param {!PropertyEffectsType} inst The instance with effects to run @param {Object} effects Object map of property-to-Array of effects @param {number} dedupeId Counter used for de-duping effects @param {string} prop Name of changed property @param {*} props Changed properti...
[ "Runs", "a", "list", "of", "effects", "for", "a", "given", "property", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L148-L165
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
runObserverEffect
function runObserverEffect(inst, property, props, oldProps, info) { let fn = typeof info.method === "string" ? inst[info.method] : info.method; let changedProp = info.property; if (fn) { fn.call(inst, inst.__data[changedProp], oldProps[changedProp]); } else if (!info.dynamicFn) { console.warn('observer ...
javascript
function runObserverEffect(inst, property, props, oldProps, info) { let fn = typeof info.method === "string" ? inst[info.method] : info.method; let changedProp = info.property; if (fn) { fn.call(inst, inst.__data[changedProp], oldProps[changedProp]); } else if (!info.dynamicFn) { console.warn('observer ...
[ "function", "runObserverEffect", "(", "inst", ",", "property", ",", "props", ",", "oldProps", ",", "info", ")", "{", "let", "fn", "=", "typeof", "info", ".", "method", "===", "\"string\"", "?", "inst", "[", "info", ".", "method", "]", ":", "info", ".",...
Implements the "observer" effect. Calls the method with `info.methodName` on the instance, passing the new and old values. @param {!PropertyEffectsType} inst The instance the effect will be run on @param {string} property Name of property @param {Object} props Bag of current property changes @param {Object} oldProps ...
[ "Implements", "the", "observer", "effect", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L210-L218
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
runNotifyEffects
function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) { // Notify let fxs = inst[TYPES.NOTIFY]; let notified; let id = dedupeId++; // Try normal notify effects; if none, fall back to try path notification for (let prop in notifyProps) { if (notifyProps[prop]) { if (fxs && runEffe...
javascript
function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) { // Notify let fxs = inst[TYPES.NOTIFY]; let notified; let id = dedupeId++; // Try normal notify effects; if none, fall back to try path notification for (let prop in notifyProps) { if (notifyProps[prop]) { if (fxs && runEffe...
[ "function", "runNotifyEffects", "(", "inst", ",", "notifyProps", ",", "props", ",", "oldProps", ",", "hasPaths", ")", "{", "// Notify", "let", "fxs", "=", "inst", "[", "TYPES", ".", "NOTIFY", "]", ";", "let", "notified", ";", "let", "id", "=", "dedupeId"...
Runs "notify" effects for a set of changed properties. This method differs from the generic `runEffects` method in that it will dispatch path notification events in the case that the property changed was a path and the root property for that path didn't have a "notify" effect. This is to maintain 1.0 behavior that di...
[ "Runs", "notify", "effects", "for", "a", "set", "of", "changed", "properties", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L238-L260
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
runNotifyEffect
function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) { let rootProperty = hasPaths ? root$0(property) : property; let path = rootProperty != property ? property : null; let value = path ? get$0(inst, path) : inst.__data[property]; if (path && value === undefined) { value = props[propert...
javascript
function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) { let rootProperty = hasPaths ? root$0(property) : property; let path = rootProperty != property ? property : null; let value = path ? get$0(inst, path) : inst.__data[property]; if (path && value === undefined) { value = props[propert...
[ "function", "runNotifyEffect", "(", "inst", ",", "property", ",", "props", ",", "oldProps", ",", "info", ",", "hasPaths", ")", "{", "let", "rootProperty", "=", "hasPaths", "?", "root$0", "(", "property", ")", ":", "property", ";", "let", "path", "=", "ro...
Implements the "notify" effect. Dispatches a non-bubbling event named `info.eventName` on the instance with a detail object containing the new `value`. @param {!PropertyEffectsType} inst The instance the effect will be run on @param {string} property Name of property @param {Object} props Bag of current property chan...
[ "Implements", "the", "notify", "effect", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L321-L329
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
runReflectEffect
function runReflectEffect(inst, property, props, oldProps, info) { let value = inst.__data[property]; if (sanitizeDOMValue) { value = sanitizeDOMValue(value, info.attrName, 'attribute', /** @type {Node} */(inst)); } inst._propertyToAttribute(property, info.attrName, value); }
javascript
function runReflectEffect(inst, property, props, oldProps, info) { let value = inst.__data[property]; if (sanitizeDOMValue) { value = sanitizeDOMValue(value, info.attrName, 'attribute', /** @type {Node} */(inst)); } inst._propertyToAttribute(property, info.attrName, value); }
[ "function", "runReflectEffect", "(", "inst", ",", "property", ",", "props", ",", "oldProps", ",", "info", ")", "{", "let", "value", "=", "inst", ".", "__data", "[", "property", "]", ";", "if", "(", "sanitizeDOMValue", ")", "{", "value", "=", "sanitizeDOM...
Implements the "reflect" effect. Sets the attribute named `info.attrName` to the given property value. @param {!PropertyEffectsType} inst The instance the effect will be run on @param {string} property Name of property @param {Object} props Bag of current property changes @param {Object} oldProps Bag of previous valu...
[ "Implements", "the", "reflect", "effect", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L380-L386
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
runComputedEffects
function runComputedEffects(inst, changedProps, oldProps, hasPaths) { let computeEffects = inst[TYPES.COMPUTE]; if (computeEffects) { let inputProps = changedProps; while (runEffects(inst, computeEffects, inputProps, oldProps, hasPaths)) { Object.assign(oldProps, inst.__dataOld); Object.assign(c...
javascript
function runComputedEffects(inst, changedProps, oldProps, hasPaths) { let computeEffects = inst[TYPES.COMPUTE]; if (computeEffects) { let inputProps = changedProps; while (runEffects(inst, computeEffects, inputProps, oldProps, hasPaths)) { Object.assign(oldProps, inst.__dataOld); Object.assign(c...
[ "function", "runComputedEffects", "(", "inst", ",", "changedProps", ",", "oldProps", ",", "hasPaths", ")", "{", "let", "computeEffects", "=", "inst", "[", "TYPES", ".", "COMPUTE", "]", ";", "if", "(", "computeEffects", ")", "{", "let", "inputProps", "=", "...
Runs "computed" effects for a set of changed properties. This method differs from the generic `runEffects` method in that it continues to run computed effects based on the output of each pass until there are no more newly computed properties. This ensures that all properties that will be computed by the initial set o...
[ "Runs", "computed", "effects", "for", "a", "set", "of", "changed", "properties", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L405-L416
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
runComputedEffect
function runComputedEffect(inst, property, props, oldProps, info) { let result = runMethodEffect(inst, property, props, oldProps, info); let computedProp = info.methodInfo; if (inst.__dataHasAccessor && inst.__dataHasAccessor[computedProp]) { inst._setPendingProperty(computedProp, result, true); } else { ...
javascript
function runComputedEffect(inst, property, props, oldProps, info) { let result = runMethodEffect(inst, property, props, oldProps, info); let computedProp = info.methodInfo; if (inst.__dataHasAccessor && inst.__dataHasAccessor[computedProp]) { inst._setPendingProperty(computedProp, result, true); } else { ...
[ "function", "runComputedEffect", "(", "inst", ",", "property", ",", "props", ",", "oldProps", ",", "info", ")", "{", "let", "result", "=", "runMethodEffect", "(", "inst", ",", "property", ",", "props", ",", "oldProps", ",", "info", ")", ";", "let", "comp...
Implements the "computed property" effect by running the method with the values of the arguments specified in the `info` object and setting the return value to the computed property specified. @param {!PropertyEffectsType} inst The instance the effect will be run on @param {string} property Name of property @param {Ob...
[ "Implements", "the", "computed", "property", "effect", "by", "running", "the", "method", "with", "the", "values", "of", "the", "arguments", "specified", "in", "the", "info", "object", "and", "setting", "the", "return", "value", "to", "the", "computed", "proper...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L431-L439
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
computeLinkedPaths
function computeLinkedPaths(inst, path, value) { let links = inst.__dataLinkedPaths; if (links) { let link; for (let a in links) { let b = links[a]; if (isDescendant(a, path)) { link = translate(a, b, path); inst._setPendingPropertyOrPath(link, value, true, true); } else if...
javascript
function computeLinkedPaths(inst, path, value) { let links = inst.__dataLinkedPaths; if (links) { let link; for (let a in links) { let b = links[a]; if (isDescendant(a, path)) { link = translate(a, b, path); inst._setPendingPropertyOrPath(link, value, true, true); } else if...
[ "function", "computeLinkedPaths", "(", "inst", ",", "path", ",", "value", ")", "{", "let", "links", "=", "inst", ".", "__dataLinkedPaths", ";", "if", "(", "links", ")", "{", "let", "link", ";", "for", "(", "let", "a", "in", "links", ")", "{", "let", ...
Computes path changes based on path links set up using the `linkPaths` API. @param {!PropertyEffectsType} inst The instance whose props are changing @param {string | !Array<(string|number)>} path Path that has changed @param {*} value Value of changed path @return {void} @private
[ "Computes", "path", "changes", "based", "on", "path", "links", "set", "up", "using", "the", "linkPaths", "API", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L451-L466
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
addEffectForBindingPart
function addEffectForBindingPart(constructor, templateInfo, binding, part, index) { if (!part.literal) { if (binding.kind === 'attribute' && binding.target[0] === '-') { console.warn('Cannot set attribute ' + binding.target + ' because "-" is not a valid attribute starting character'); } else { ...
javascript
function addEffectForBindingPart(constructor, templateInfo, binding, part, index) { if (!part.literal) { if (binding.kind === 'attribute' && binding.target[0] === '-') { console.warn('Cannot set attribute ' + binding.target + ' because "-" is not a valid attribute starting character'); } else { ...
[ "function", "addEffectForBindingPart", "(", "constructor", ",", "templateInfo", ",", "binding", ",", "part", ",", "index", ")", "{", "if", "(", "!", "part", ".", "literal", ")", "{", "if", "(", "binding", ".", "kind", "===", "'attribute'", "&&", "binding",...
Adds property effects to the given `templateInfo` for the given binding part. @param {Function} constructor Class that `_parseTemplate` is currently running on @param {TemplateInfo} templateInfo Template metadata for current template @param {!Binding} binding Binding metadata @param {!BindingPart} part Binding part me...
[ "Adds", "property", "effects", "to", "the", "given", "templateInfo", "for", "the", "given", "binding", "part", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L519-L540
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
computeBindingValue
function computeBindingValue(node, value, binding, part) { if (binding.isCompound) { let storage = node.__dataCompoundStorage[binding.target]; storage[part.compoundIndex] = value; value = storage.join(''); } if (binding.kind !== 'attribute') { // Some browsers serialize `undefined` to `"undefined"...
javascript
function computeBindingValue(node, value, binding, part) { if (binding.isCompound) { let storage = node.__dataCompoundStorage[binding.target]; storage[part.compoundIndex] = value; value = storage.join(''); } if (binding.kind !== 'attribute') { // Some browsers serialize `undefined` to `"undefined"...
[ "function", "computeBindingValue", "(", "node", ",", "value", ",", "binding", ",", "part", ")", "{", "if", "(", "binding", ".", "isCompound", ")", "{", "let", "storage", "=", "node", ".", "__dataCompoundStorage", "[", "binding", ".", "target", "]", ";", ...
Transforms an "binding" effect value based on compound & negation effect metadata, as well as handling for special-case properties @param {Node} node Node the value will be set to @param {*} value Value to set @param {!Binding} binding Binding metadata @param {!BindingPart} part Binding part metadata @return {*} Trans...
[ "Transforms", "an", "binding", "effect", "value", "based", "on", "compound", "&", "negation", "effect", "metadata", "as", "well", "as", "handling", "for", "special", "-", "case", "properties" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L631-L646
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
setupBindings
function setupBindings(inst, templateInfo) { // Setup compound storage, dataHost, and notify listeners let {nodeList, nodeInfoList} = templateInfo; if (nodeInfoList.length) { for (let i=0; i < nodeInfoList.length; i++) { let info = nodeInfoList[i]; let node = nodeList[i]; let bindings = info...
javascript
function setupBindings(inst, templateInfo) { // Setup compound storage, dataHost, and notify listeners let {nodeList, nodeInfoList} = templateInfo; if (nodeInfoList.length) { for (let i=0; i < nodeInfoList.length; i++) { let info = nodeInfoList[i]; let node = nodeList[i]; let bindings = info...
[ "function", "setupBindings", "(", "inst", ",", "templateInfo", ")", "{", "// Setup compound storage, dataHost, and notify listeners", "let", "{", "nodeList", ",", "nodeInfoList", "}", "=", "templateInfo", ";", "if", "(", "nodeInfoList", ".", "length", ")", "{", "for...
Setup compound binding storage structures, notify listeners, and dataHost references onto the bound nodeList. @param {!PropertyEffectsType} inst Instance that bas been previously bound @param {TemplateInfo} templateInfo Template metadata @return {void} @private
[ "Setup", "compound", "binding", "storage", "structures", "notify", "listeners", "and", "dataHost", "references", "onto", "the", "bound", "nodeList", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L678-L696
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
addNotifyListener
function addNotifyListener(node, inst, binding) { if (binding.listenerEvent) { let part = binding.parts[0]; node.addEventListener(binding.listenerEvent, function(e) { handleNotification(e, inst, binding.target, part.source, part.negate); }); } }
javascript
function addNotifyListener(node, inst, binding) { if (binding.listenerEvent) { let part = binding.parts[0]; node.addEventListener(binding.listenerEvent, function(e) { handleNotification(e, inst, binding.target, part.source, part.negate); }); } }
[ "function", "addNotifyListener", "(", "node", ",", "inst", ",", "binding", ")", "{", "if", "(", "binding", ".", "listenerEvent", ")", "{", "let", "part", "=", "binding", ".", "parts", "[", "0", "]", ";", "node", ".", "addEventListener", "(", "binding", ...
Adds a 2-way binding notification event listener to the node specified @param {Object} node Child element to add listener to @param {!PropertyEffectsType} inst Host element instance to handle notification event @param {Binding} binding Binding metadata @return {void} @private
[ "Adds", "a", "2", "-", "way", "binding", "notification", "event", "listener", "to", "the", "node", "specified" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L741-L748
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
runMethodEffect
function runMethodEffect(inst, property, props, oldProps, info) { // Instances can optionally have a _methodHost which allows redirecting where // to find methods. Currently used by `templatize`. let context = inst._methodHost || inst; let fn = context[info.methodName]; if (fn) { let args = marshalArgs(in...
javascript
function runMethodEffect(inst, property, props, oldProps, info) { // Instances can optionally have a _methodHost which allows redirecting where // to find methods. Currently used by `templatize`. let context = inst._methodHost || inst; let fn = context[info.methodName]; if (fn) { let args = marshalArgs(in...
[ "function", "runMethodEffect", "(", "inst", ",", "property", ",", "props", ",", "oldProps", ",", "info", ")", "{", "// Instances can optionally have a _methodHost which allows redirecting where", "// to find methods. Currently used by `templatize`.", "let", "context", "=", "ins...
Calls a method with arguments marshaled from properties on the instance based on the method signature contained in the effect metadata. Multi-property observers, computed properties, and inline computing functions call this function to invoke the method, then use the return value accordingly. @param {!PropertyEffects...
[ "Calls", "a", "method", "with", "arguments", "marshaled", "from", "properties", "on", "the", "instance", "based", "on", "the", "method", "signature", "contained", "in", "the", "effect", "metadata", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L808-L819
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
literalFromParts
function literalFromParts(parts) { let s = ''; for (let i=0; i<parts.length; i++) { let literal = parts[i].literal; s += literal || ''; } return s; }
javascript
function literalFromParts(parts) { let s = ''; for (let i=0; i<parts.length; i++) { let literal = parts[i].literal; s += literal || ''; } return s; }
[ "function", "literalFromParts", "(", "parts", ")", "{", "let", "s", "=", "''", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "parts", ".", "length", ";", "i", "++", ")", "{", "let", "literal", "=", "parts", "[", "i", "]", ".", "literal"...
Create a string from binding parts of all the literal parts @param {!Array<BindingPart>} parts All parts to stringify @return {string} String made from the literal parts
[ "Create", "a", "string", "from", "binding", "parts", "of", "all", "the", "literal", "parts" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L847-L854
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
parseArgs
function parseArgs(argList, sig) { sig.args = argList.map(function(rawArg) { let arg = parseArg(rawArg); if (!arg.literal) { sig.static = false; } return arg; }, this); return sig; }
javascript
function parseArgs(argList, sig) { sig.args = argList.map(function(rawArg) { let arg = parseArg(rawArg); if (!arg.literal) { sig.static = false; } return arg; }, this); return sig; }
[ "function", "parseArgs", "(", "argList", ",", "sig", ")", "{", "sig", ".", "args", "=", "argList", ".", "map", "(", "function", "(", "rawArg", ")", "{", "let", "arg", "=", "parseArg", "(", "rawArg", ")", ";", "if", "(", "!", "arg", ".", "literal", ...
Parses an array of arguments and sets the `args` property of the supplied signature metadata object. Sets the `static` property to false if any argument is a non-literal. @param {!Array<string>} argList Array of argument names @param {!MethodSignature} sig Method signature metadata object @return {!MethodSignature} Th...
[ "Parses", "an", "array", "of", "arguments", "and", "sets", "the", "args", "property", "of", "the", "supplied", "signature", "metadata", "object", ".", "Sets", "the", "static", "property", "to", "false", "if", "any", "argument", "is", "a", "non", "-", "lite...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L893-L902
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
marshalArgs
function marshalArgs(data, args, path, props) { let values = []; for (let i=0, l=args.length; i<l; i++) { let arg = args[i]; let name = arg.name; let v; if (arg.literal) { v = arg.value; } else { if (arg.structured) { v = get$0(data, name); // when data is not stored ...
javascript
function marshalArgs(data, args, path, props) { let values = []; for (let i=0, l=args.length; i<l; i++) { let arg = args[i]; let name = arg.name; let v; if (arg.literal) { v = arg.value; } else { if (arg.structured) { v = get$0(data, name); // when data is not stored ...
[ "function", "marshalArgs", "(", "data", ",", "args", ",", "path", ",", "props", ")", "{", "let", "values", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ",", "l", "=", "args", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", ...
Gather the argument values for a method specified in the provided array of argument metadata. The `path` and `value` arguments are used to fill in wildcard descriptor when the method is being called as a result of a path notification. @param {Object} data Instance data storage object to read properties from @param {!...
[ "Gather", "the", "argument", "values", "for", "a", "method", "specified", "in", "the", "provided", "array", "of", "argument", "metadata", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L984-L1018
train
catapult-project/catapult
third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js
notifySplice
function notifySplice(inst, array, path, index, addedCount, removed) { notifySplices(inst, array, path, [{ index: index, addedCount: addedCount, removed: removed, object: array, type: 'splice' }]); }
javascript
function notifySplice(inst, array, path, index, addedCount, removed) { notifySplices(inst, array, path, [{ index: index, addedCount: addedCount, removed: removed, object: array, type: 'splice' }]); }
[ "function", "notifySplice", "(", "inst", ",", "array", ",", "path", ",", "index", ",", "addedCount", ",", "removed", ")", "{", "notifySplices", "(", "inst", ",", "array", ",", "path", ",", "[", "{", "index", ":", "index", ",", "addedCount", ":", "added...
Creates a splice record and sends an array splice notification for the described mutation Note: this implementation only accepts normalized paths @param {!PropertyEffectsType} inst Instance to send notifications to @param {Array} array The array the mutations occurred on @param {string} path The path to the array tha...
[ "Creates", "a", "splice", "record", "and", "sends", "an", "array", "splice", "notification", "for", "the", "described", "mutation" ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/third_party/polymer3/bower_components/polymer/lib/mixins/property-effects.js#L1057-L1065
train
catapult-project/catapult
experimental/perf_sheriffing_emailer/api_access.js
getService
function getService(privateKeyDetails) { return OAuth2.createService('PerfDash:' + Session.getActiveUser().getEmail()) // Set the endpoint URL. .setTokenUrl('https://accounts.google.com/o/oauth2/token') // Set the private key and issuer. .setPrivateKey(privateKeyDetails['private_key']) ...
javascript
function getService(privateKeyDetails) { return OAuth2.createService('PerfDash:' + Session.getActiveUser().getEmail()) // Set the endpoint URL. .setTokenUrl('https://accounts.google.com/o/oauth2/token') // Set the private key and issuer. .setPrivateKey(privateKeyDetails['private_key']) ...
[ "function", "getService", "(", "privateKeyDetails", ")", "{", "return", "OAuth2", ".", "createService", "(", "'PerfDash:'", "+", "Session", ".", "getActiveUser", "(", ")", ".", "getEmail", "(", ")", ")", "// Set the endpoint URL.", ".", "setTokenUrl", "(", "'htt...
Configures the service. @param {Object} privateKeyDetails Dict with private key and client email.
[ "Configures", "the", "service", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/experimental/perf_sheriffing_emailer/api_access.js#L43-L58
train
catapult-project/catapult
experimental/perf_sheriffing_emailer/api_access.js
getPrivateKeyDetailsFromDriveFile
function getPrivateKeyDetailsFromDriveFile(driveFileId) { var file = DriveApp.getFileById(driveFileId); return JSON.parse(file.getAs('application/json').getDataAsString()); }
javascript
function getPrivateKeyDetailsFromDriveFile(driveFileId) { var file = DriveApp.getFileById(driveFileId); return JSON.parse(file.getAs('application/json').getDataAsString()); }
[ "function", "getPrivateKeyDetailsFromDriveFile", "(", "driveFileId", ")", "{", "var", "file", "=", "DriveApp", ".", "getFileById", "(", "driveFileId", ")", ";", "return", "JSON", ".", "parse", "(", "file", ".", "getAs", "(", "'application/json'", ")", ".", "ge...
Parse the private key details from a file stored in Google Drive. @param {string} driveFileId The id of the file in drive to parse.
[ "Parse", "the", "private", "key", "details", "from", "a", "file", "stored", "in", "Google", "Drive", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/experimental/perf_sheriffing_emailer/api_access.js#L64-L67
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
writeHexString
function writeHexString(bytes, out) { function byteToPaddedHex(b) { let str = b.toString(16).toUpperCase(); if (str.length < 2) { str = '0' + str; } return str; } const kBytesPerLine = 16; // Returns pretty printed kBytesPerLine bytes starting from // bytes[startInde...
javascript
function writeHexString(bytes, out) { function byteToPaddedHex(b) { let str = b.toString(16).toUpperCase(); if (str.length < 2) { str = '0' + str; } return str; } const kBytesPerLine = 16; // Returns pretty printed kBytesPerLine bytes starting from // bytes[startInde...
[ "function", "writeHexString", "(", "bytes", ",", "out", ")", "{", "function", "byteToPaddedHex", "(", "b", ")", "{", "let", "str", "=", "b", ".", "toString", "(", "16", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "str", ".", "length", "<", "...
|bytes| must be an array-like object of bytes. Writes multiple lines to |out| with the hexadecimal characters from |bytes| on the left, in groups of two, and their corresponding ASCII characters on the right. 16 bytes will be placed on each line of the output string, split into two columns of 8.
[ "|bytes|", "must", "be", "an", "array", "-", "like", "object", "of", "bytes", ".", "Writes", "multiple", "lines", "to", "|out|", "with", "the", "hexadecimal", "characters", "from", "|bytes|", "on", "the", "left", "in", "groups", "of", "two", "and", "their"...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L123-L186
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
writeParameters
function writeParameters(entry, out) { // If headers are in an object, convert them to an array for better // display. entry = reformatHeaders(entry); // Use any parameter writer available for this event type. const paramsWriter = getParameterWriterForEventType(entry.type); const consumedParams...
javascript
function writeParameters(entry, out) { // If headers are in an object, convert them to an array for better // display. entry = reformatHeaders(entry); // Use any parameter writer available for this event type. const paramsWriter = getParameterWriterForEventType(entry.type); const consumedParams...
[ "function", "writeParameters", "(", "entry", ",", "out", ")", "{", "// If headers are in an object, convert them to an array for better", "// display.", "entry", "=", "reformatHeaders", "(", "entry", ")", ";", "// Use any parameter writer available for this event type.", "const",...
Formats the parameters for |entry| and writes them to |out|. Certain event types have custom pretty printers. Everything else will default to a JSON-like format.
[ "Formats", "the", "parameters", "for", "|entry|", "and", "writes", "them", "to", "|out|", ".", "Certain", "event", "types", "have", "custom", "pretty", "printers", ".", "Everything", "else", "will", "default", "to", "a", "JSON", "-", "like", "format", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L275-L294
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
getParameterWriterForEventType
function getParameterWriterForEventType(eventType) { switch (eventType) { case EventType.HTTP_TRANSACTION_SEND_REQUEST_HEADERS: case EventType.HTTP_TRANSACTION_SEND_TUNNEL_HEADERS: case EventType.TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS: return writeParamsForRequestHeaders; case Event...
javascript
function getParameterWriterForEventType(eventType) { switch (eventType) { case EventType.HTTP_TRANSACTION_SEND_REQUEST_HEADERS: case EventType.HTTP_TRANSACTION_SEND_TUNNEL_HEADERS: case EventType.TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS: return writeParamsForRequestHeaders; case Event...
[ "function", "getParameterWriterForEventType", "(", "eventType", ")", "{", "switch", "(", "eventType", ")", "{", "case", "EventType", ".", "HTTP_TRANSACTION_SEND_REQUEST_HEADERS", ":", "case", "EventType", ".", "HTTP_TRANSACTION_SEND_TUNNEL_HEADERS", ":", "case", "EventTyp...
Finds a writer to format the parameters for events of type |eventType|. @return {function} The returned function "writer" can be invoked as |writer(entry, writer, consumedParams)|. It will output the parameters of |entry| to |out|, and fill |consumedParams| with the keys of the parameters consumed. If no writer is ava...
[ "Finds", "a", "writer", "to", "format", "the", "parameters", "for", "events", "of", "type", "|eventType|", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L306-L324
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
tryParseHexToBytes
function tryParseHexToBytes(hexStr) { if ((hexStr.length % 2) !== 0) { return null; } const result = []; for (let i = 0; i < hexStr.length; i += 2) { const value = parseInt(hexStr.substr(i, 2), 16); if (isNaN(value)) { return null; } result.push(value); } ...
javascript
function tryParseHexToBytes(hexStr) { if ((hexStr.length % 2) !== 0) { return null; } const result = []; for (let i = 0; i < hexStr.length; i += 2) { const value = parseInt(hexStr.substr(i, 2), 16); if (isNaN(value)) { return null; } result.push(value); } ...
[ "function", "tryParseHexToBytes", "(", "hexStr", ")", "{", "if", "(", "(", "hexStr", ".", "length", "%", "2", ")", "!==", "0", ")", "{", "return", "null", ";", "}", "const", "result", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "...
Parses |hexStr| to an array of bytes, or returns null if the input is not a valid hex string.
[ "Parses", "|hexStr|", "to", "an", "array", "of", "bytes", "or", "returns", "null", "if", "the", "input", "is", "not", "a", "valid", "hex", "string", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L330-L345
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
tryParseBase64ToBytes
function tryParseBase64ToBytes(b64Str) { let decodedStr; try { decodedStr = atob(b64Str); } catch (e) { return null; } return Uint8Array.from(decodedStr, c => c.charCodeAt(0)); }
javascript
function tryParseBase64ToBytes(b64Str) { let decodedStr; try { decodedStr = atob(b64Str); } catch (e) { return null; } return Uint8Array.from(decodedStr, c => c.charCodeAt(0)); }
[ "function", "tryParseBase64ToBytes", "(", "b64Str", ")", "{", "let", "decodedStr", ";", "try", "{", "decodedStr", "=", "atob", "(", "b64Str", ")", ";", "}", "catch", "(", "e", ")", "{", "return", "null", ";", "}", "return", "Uint8Array", ".", "from", "...
Parses a base64 encoded string to a Uint8Array of bytes.
[ "Parses", "a", "base64", "encoded", "string", "to", "a", "Uint8Array", "of", "bytes", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L350-L360
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
defaultWriteParameter
function defaultWriteParameter(key, value, out) { if (key === 'headers' && value instanceof Array) { out.writeArrowIndentedLines(value); return; } // For transferred bytes, display the bytes in hex and ASCII. // TODO(eroman): 'hex_encoded_bytes' was removed in M73, and // ...
javascript
function defaultWriteParameter(key, value, out) { if (key === 'headers' && value instanceof Array) { out.writeArrowIndentedLines(value); return; } // For transferred bytes, display the bytes in hex and ASCII. // TODO(eroman): 'hex_encoded_bytes' was removed in M73, and // ...
[ "function", "defaultWriteParameter", "(", "key", ",", "value", ",", "out", ")", "{", "if", "(", "key", "===", "'headers'", "&&", "value", "instanceof", "Array", ")", "{", "out", ".", "writeArrowIndentedLines", "(", "value", ")", ";", "return", ";", "}", ...
Default parameter writer that outputs a visualization of field named |key| with value |value| to |out|.
[ "Default", "parameter", "writer", "that", "outputs", "a", "visualization", "of", "field", "named", "|key|", "with", "value", "|value|", "to", "|out|", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L366-L440
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
getSymbolicString
function getSymbolicString(bitmask, valueToName, zeroName) { const matchingFlagNames = []; for (const k in valueToName) { if (bitmask & valueToName[k]) { matchingFlagNames.push(k); } } // If no flags were matched, returns a special value. if (matchingFlagNames.length === 0) { ...
javascript
function getSymbolicString(bitmask, valueToName, zeroName) { const matchingFlagNames = []; for (const k in valueToName) { if (bitmask & valueToName[k]) { matchingFlagNames.push(k); } } // If no flags were matched, returns a special value. if (matchingFlagNames.length === 0) { ...
[ "function", "getSymbolicString", "(", "bitmask", ",", "valueToName", ",", "zeroName", ")", "{", "const", "matchingFlagNames", "=", "[", "]", ";", "for", "(", "const", "k", "in", "valueToName", ")", "{", "if", "(", "bitmask", "&", "valueToName", "[", "k", ...
Returns a string representing the flags composing the given bitmask.
[ "Returns", "a", "string", "representing", "the", "flags", "composing", "the", "given", "bitmask", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L462-L477
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
reformatHeaders
function reformatHeaders(entry) { // If there are no headers, or it is not an object other than an array, // return |entry| without modification. if (!entry.params || entry.params.headers === undefined || typeof entry.params.headers !== 'object' || entry.params.headers instanceof Array) { ...
javascript
function reformatHeaders(entry) { // If there are no headers, or it is not an object other than an array, // return |entry| without modification. if (!entry.params || entry.params.headers === undefined || typeof entry.params.headers !== 'object' || entry.params.headers instanceof Array) { ...
[ "function", "reformatHeaders", "(", "entry", ")", "{", "// If there are no headers, or it is not an object other than an array,", "// return |entry| without modification.", "if", "(", "!", "entry", ".", "params", "||", "entry", ".", "params", ".", "headers", "===", "undefin...
If entry.param.headers exists and is an object other than an array, converts it into an array and returns a new entry. Otherwise, just returns the original entry.
[ "If", "entry", ".", "param", ".", "headers", "exists", "and", "is", "an", "object", "other", "than", "an", "array", "converts", "it", "into", "an", "array", "and", "returns", "a", "new", "entry", ".", "Otherwise", "just", "returns", "the", "original", "e...
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L501-L524
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
writeParamsForRequestHeaders
function writeParamsForRequestHeaders(entry, out, consumedParams) { const params = entry.params; if (!(typeof params.line === 'string') || !(params.headers instanceof Array)) { // Unrecognized params. return; } // Strip the trailing CRLF that params.line contains. const lineWit...
javascript
function writeParamsForRequestHeaders(entry, out, consumedParams) { const params = entry.params; if (!(typeof params.line === 'string') || !(params.headers instanceof Array)) { // Unrecognized params. return; } // Strip the trailing CRLF that params.line contains. const lineWit...
[ "function", "writeParamsForRequestHeaders", "(", "entry", ",", "out", ",", "consumedParams", ")", "{", "const", "params", "=", "entry", ".", "params", ";", "if", "(", "!", "(", "typeof", "params", ".", "line", "===", "'string'", ")", "||", "!", "(", "par...
Outputs the request header parameters of |entry| to |out|.
[ "Outputs", "the", "request", "header", "parameters", "of", "|entry|", "to", "|out|", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L529-L544
train
catapult-project/catapult
netlog_viewer/netlog_viewer/log_view_painter.js
writeParamsForCertificates
function writeParamsForCertificates(entry, out, consumedParams) { writeCertificateParam(entry.params, out, consumedParams, 'certificates'); if (typeof(entry.params.verified_cert) === 'object') { writeCertificateParam( entry.params.verified_cert, out, consumedParams, 'verified_cert'); } ...
javascript
function writeParamsForCertificates(entry, out, consumedParams) { writeCertificateParam(entry.params, out, consumedParams, 'certificates'); if (typeof(entry.params.verified_cert) === 'object') { writeCertificateParam( entry.params.verified_cert, out, consumedParams, 'verified_cert'); } ...
[ "function", "writeParamsForCertificates", "(", "entry", ",", "out", ",", "consumedParams", ")", "{", "writeCertificateParam", "(", "entry", ".", "params", ",", "out", ",", "consumedParams", ",", "'certificates'", ")", ";", "if", "(", "typeof", "(", "entry", "....
Outputs the certificate parameters of |entry| to |out|.
[ "Outputs", "the", "certificate", "parameters", "of", "|entry|", "to", "|out|", "." ]
992929ffccac68827869a497f01ee4d653ed4f25
https://github.com/catapult-project/catapult/blob/992929ffccac68827869a497f01ee4d653ed4f25/netlog_viewer/netlog_viewer/log_view_painter.js#L562-L576
train