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
iamdustan/smoothscroll
src/smoothscroll.js
canOverflow
function canOverflow(el, axis) { var overflowValue = w.getComputedStyle(el, null)['overflow' + axis]; return overflowValue === 'auto' || overflowValue === 'scroll'; }
javascript
function canOverflow(el, axis) { var overflowValue = w.getComputedStyle(el, null)['overflow' + axis]; return overflowValue === 'auto' || overflowValue === 'scroll'; }
[ "function", "canOverflow", "(", "el", ",", "axis", ")", "{", "var", "overflowValue", "=", "w", ".", "getComputedStyle", "(", "el", ",", "null", ")", "[", "'overflow'", "+", "axis", "]", ";", "return", "overflowValue", "===", "'auto'", "||", "overflowValue"...
indicates if an element has a scrollable overflow property in the axis @method canOverflow @param {Node} el @param {String} axis @returns {Boolean}
[ "indicates", "if", "an", "element", "has", "a", "scrollable", "overflow", "property", "in", "the", "axis" ]
46ce13e65eee17640dacbbd50f7c64f4a393b3ef
https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L132-L136
train
iamdustan/smoothscroll
src/smoothscroll.js
isScrollable
function isScrollable(el) { var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y'); var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X'); return isScrollableY || isScrollableX; }
javascript
function isScrollable(el) { var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y'); var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X'); return isScrollableY || isScrollableX; }
[ "function", "isScrollable", "(", "el", ")", "{", "var", "isScrollableY", "=", "hasScrollableSpace", "(", "el", ",", "'Y'", ")", "&&", "canOverflow", "(", "el", ",", "'Y'", ")", ";", "var", "isScrollableX", "=", "hasScrollableSpace", "(", "el", ",", "'X'", ...
indicates if an element can be scrolled in either axis @method isScrollable @param {Node} el @param {String} axis @returns {Boolean}
[ "indicates", "if", "an", "element", "can", "be", "scrolled", "in", "either", "axis" ]
46ce13e65eee17640dacbbd50f7c64f4a393b3ef
https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L145-L150
train
iamdustan/smoothscroll
src/smoothscroll.js
findScrollableParent
function findScrollableParent(el) { while (el !== d.body && isScrollable(el) === false) { el = el.parentNode || el.host; } return el; }
javascript
function findScrollableParent(el) { while (el !== d.body && isScrollable(el) === false) { el = el.parentNode || el.host; } return el; }
[ "function", "findScrollableParent", "(", "el", ")", "{", "while", "(", "el", "!==", "d", ".", "body", "&&", "isScrollable", "(", "el", ")", "===", "false", ")", "{", "el", "=", "el", ".", "parentNode", "||", "el", ".", "host", ";", "}", "return", "...
finds scrollable parent of an element @method findScrollableParent @param {Node} el @returns {Node} el
[ "finds", "scrollable", "parent", "of", "an", "element" ]
46ce13e65eee17640dacbbd50f7c64f4a393b3ef
https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L158-L164
train
iamdustan/smoothscroll
src/smoothscroll.js
smoothScroll
function smoothScroll(el, x, y) { var scrollable; var startX; var startY; var method; var startTime = now(); // define scroll context if (el === d.body) { scrollable = w; startX = w.scrollX || w.pageXOffset; startY = w.scrollY || w.pageYOffset; method = original.scro...
javascript
function smoothScroll(el, x, y) { var scrollable; var startX; var startY; var method; var startTime = now(); // define scroll context if (el === d.body) { scrollable = w; startX = w.scrollX || w.pageXOffset; startY = w.scrollY || w.pageYOffset; method = original.scro...
[ "function", "smoothScroll", "(", "el", ",", "x", ",", "y", ")", "{", "var", "scrollable", ";", "var", "startX", ";", "var", "startY", ";", "var", "method", ";", "var", "startTime", "=", "now", "(", ")", ";", "// define scroll context", "if", "(", "el",...
scrolls window or element with a smooth behavior @method smoothScroll @param {Object|Node} el @param {Number} x @param {Number} y @returns {undefined}
[ "scrolls", "window", "or", "element", "with", "a", "smooth", "behavior" ]
46ce13e65eee17640dacbbd50f7c64f4a393b3ef
https://github.com/iamdustan/smoothscroll/blob/46ce13e65eee17640dacbbd50f7c64f4a393b3ef/src/smoothscroll.js#L204-L234
train
kaola-fed/megalo
dist/vue.runtime.esm.js
defineReactive$$1
function defineReactive$$1 ( obj, key, val, customSetter, shallow ) { var dep = new Dep(); var property = Object.getOwnPropertyDescriptor(obj, key); if (property && property.configurable === false) { return } // cater for pre-defined getter/setters var getter = property && property.get; va...
javascript
function defineReactive$$1 ( obj, key, val, customSetter, shallow ) { var dep = new Dep(); var property = Object.getOwnPropertyDescriptor(obj, key); if (property && property.configurable === false) { return } // cater for pre-defined getter/setters var getter = property && property.get; va...
[ "function", "defineReactive$$1", "(", "obj", ",", "key", ",", "val", ",", "customSetter", ",", "shallow", ")", "{", "var", "dep", "=", "new", "Dep", "(", ")", ";", "var", "property", "=", "Object", ".", "getOwnPropertyDescriptor", "(", "obj", ",", "key",...
Define a reactive property on an Object.
[ "Define", "a", "reactive", "property", "on", "an", "Object", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.runtime.esm.js#L999-L1058
train
kaola-fed/megalo
dist/vue.runtime.esm.js
queueWatcher
function queueWatcher (watcher) { var id = watcher.id; if (has[id] == null) { has[id] = true; if (!flushing) { queue.push(watcher); } else { // if already flushing, splice the watcher based on its id // if already past its id, it will be run next immediately. var i = queue.length...
javascript
function queueWatcher (watcher) { var id = watcher.id; if (has[id] == null) { has[id] = true; if (!flushing) { queue.push(watcher); } else { // if already flushing, splice the watcher based on its id // if already past its id, it will be run next immediately. var i = queue.length...
[ "function", "queueWatcher", "(", "watcher", ")", "{", "var", "id", "=", "watcher", ".", "id", ";", "if", "(", "has", "[", "id", "]", "==", "null", ")", "{", "has", "[", "id", "]", "=", "true", ";", "if", "(", "!", "flushing", ")", "{", "queue",...
Push a watcher into the watcher queue. Jobs with duplicate IDs will be skipped unless it's pushed when the queue is being flushed.
[ "Push", "a", "watcher", "into", "the", "watcher", "queue", ".", "Jobs", "with", "duplicate", "IDs", "will", "be", "skipped", "unless", "it", "s", "pushed", "when", "the", "queue", "is", "being", "flushed", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.runtime.esm.js#L4319-L4345
train
kaola-fed/megalo
dist/vue.runtime.esm.js
getStyle
function getStyle (vnode, checkChild) { var res = {}; var styleData; if (checkChild) { var childNode = vnode; while (childNode.componentInstance) { childNode = childNode.componentInstance._vnode; if ( childNode && childNode.data && (styleData = normalizeStyleData(childNode.dat...
javascript
function getStyle (vnode, checkChild) { var res = {}; var styleData; if (checkChild) { var childNode = vnode; while (childNode.componentInstance) { childNode = childNode.componentInstance._vnode; if ( childNode && childNode.data && (styleData = normalizeStyleData(childNode.dat...
[ "function", "getStyle", "(", "vnode", ",", "checkChild", ")", "{", "var", "res", "=", "{", "}", ";", "var", "styleData", ";", "if", "(", "checkChild", ")", "{", "var", "childNode", "=", "vnode", ";", "while", "(", "childNode", ".", "componentInstance", ...
parent component style should be after child's so that parent component's style could override it
[ "parent", "component", "style", "should", "be", "after", "child", "s", "so", "that", "parent", "component", "s", "style", "could", "override", "it" ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.runtime.esm.js#L7048-L7076
train
kaola-fed/megalo
packages/weex-template-compiler/build.js
postTransformComponent
function postTransformComponent ( el, options ) { // $flow-disable-line (we know isReservedTag is there) if (!options.isReservedTag(el.tag) && el.tag !== 'cell-slot') { addAttr(el, RECYCLE_LIST_MARKER, 'true'); } }
javascript
function postTransformComponent ( el, options ) { // $flow-disable-line (we know isReservedTag is there) if (!options.isReservedTag(el.tag) && el.tag !== 'cell-slot') { addAttr(el, RECYCLE_LIST_MARKER, 'true'); } }
[ "function", "postTransformComponent", "(", "el", ",", "options", ")", "{", "// $flow-disable-line (we know isReservedTag is there)", "if", "(", "!", "options", ".", "isReservedTag", "(", "el", ".", "tag", ")", "&&", "el", ".", "tag", "!==", "'cell-slot'", ")", "...
mark components as inside recycle-list so that we know we need to invoke their special @render function instead of render in create-component.js
[ "mark", "components", "as", "inside", "recycle", "-", "list", "so", "that", "we", "know", "we", "need", "to", "invoke", "their", "special" ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-template-compiler/build.js#L3965-L3973
train
kaola-fed/megalo
packages/weex-vue-framework/factory.js
registerComponentHook
function registerComponentHook ( componentId, type, // hook type, could be "lifecycle" or "instance" hook, // hook name fn ) { if (!document || !document.taskCenter) { warn("Can't find available \"document\" or \"taskCenter\"."); return } if (typeof document.taskCenter.registerHook === 'function')...
javascript
function registerComponentHook ( componentId, type, // hook type, could be "lifecycle" or "instance" hook, // hook name fn ) { if (!document || !document.taskCenter) { warn("Can't find available \"document\" or \"taskCenter\"."); return } if (typeof document.taskCenter.registerHook === 'function')...
[ "function", "registerComponentHook", "(", "componentId", ",", "type", ",", "// hook type, could be \"lifecycle\" or \"instance\"", "hook", ",", "// hook name", "fn", ")", "{", "if", "(", "!", "document", "||", "!", "document", ".", "taskCenter", ")", "{", "warn", ...
Register the component hook to weex native render engine. The hook will be triggered by native, not javascript.
[ "Register", "the", "component", "hook", "to", "weex", "native", "render", "engine", ".", "The", "hook", "will", "be", "triggered", "by", "native", "not", "javascript", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4082-L4096
train
kaola-fed/megalo
packages/weex-vue-framework/factory.js
updateComponentData
function updateComponentData ( componentId, newData, callback ) { if (!document || !document.taskCenter) { warn("Can't find available \"document\" or \"taskCenter\"."); return } if (typeof document.taskCenter.updateData === 'function') { return document.taskCenter.updateData(componentId, newData...
javascript
function updateComponentData ( componentId, newData, callback ) { if (!document || !document.taskCenter) { warn("Can't find available \"document\" or \"taskCenter\"."); return } if (typeof document.taskCenter.updateData === 'function') { return document.taskCenter.updateData(componentId, newData...
[ "function", "updateComponentData", "(", "componentId", ",", "newData", ",", "callback", ")", "{", "if", "(", "!", "document", "||", "!", "document", ".", "taskCenter", ")", "{", "warn", "(", "\"Can't find available \\\"document\\\" or \\\"taskCenter\\\".\"", ")", ";...
Updates the state of the component to weex native render engine.
[ "Updates", "the", "state", "of", "the", "component", "to", "weex", "native", "render", "engine", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4099-L4112
train
kaola-fed/megalo
packages/weex-vue-framework/factory.js
initVirtualComponent
function initVirtualComponent (options) { if ( options === void 0 ) options = {}; var vm = this; var componentId = options.componentId; // virtual component uid vm._uid = "virtual-component-" + (uid$2++); // a flag to avoid this being observed vm._isVue = true; // merge options if (options && optio...
javascript
function initVirtualComponent (options) { if ( options === void 0 ) options = {}; var vm = this; var componentId = options.componentId; // virtual component uid vm._uid = "virtual-component-" + (uid$2++); // a flag to avoid this being observed vm._isVue = true; // merge options if (options && optio...
[ "function", "initVirtualComponent", "(", "options", ")", "{", "if", "(", "options", "===", "void", "0", ")", "options", "=", "{", "}", ";", "var", "vm", "=", "this", ";", "var", "componentId", "=", "options", ".", "componentId", ";", "// virtual component ...
override Vue.prototype._init
[ "override", "Vue", ".", "prototype", ".", "_init" ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4121-L4187
train
kaola-fed/megalo
packages/weex-vue-framework/factory.js
updateVirtualComponent
function updateVirtualComponent (vnode) { var vm = this; var componentId = vm.$options.componentId; if (vm._isMounted) { callHook(vm, 'beforeUpdate'); } vm._vnode = vnode; if (vm._isMounted && componentId) { // TODO: data should be filtered and without bindings var data = Object.assign({}, vm._d...
javascript
function updateVirtualComponent (vnode) { var vm = this; var componentId = vm.$options.componentId; if (vm._isMounted) { callHook(vm, 'beforeUpdate'); } vm._vnode = vnode; if (vm._isMounted && componentId) { // TODO: data should be filtered and without bindings var data = Object.assign({}, vm._d...
[ "function", "updateVirtualComponent", "(", "vnode", ")", "{", "var", "vm", "=", "this", ";", "var", "componentId", "=", "vm", ".", "$options", ".", "componentId", ";", "if", "(", "vm", ".", "_isMounted", ")", "{", "callHook", "(", "vm", ",", "'beforeUpda...
override Vue.prototype._update
[ "override", "Vue", ".", "prototype", ".", "_update" ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4190-L4204
train
kaola-fed/megalo
packages/weex-vue-framework/factory.js
resolveVirtualComponent
function resolveVirtualComponent (vnode) { var BaseCtor = vnode.componentOptions.Ctor; var VirtualComponent = BaseCtor.extend({}); var cid = VirtualComponent.cid; VirtualComponent.prototype._init = initVirtualComponent; VirtualComponent.prototype._update = updateVirtualComponent; vnode.componentOptions.Cto...
javascript
function resolveVirtualComponent (vnode) { var BaseCtor = vnode.componentOptions.Ctor; var VirtualComponent = BaseCtor.extend({}); var cid = VirtualComponent.cid; VirtualComponent.prototype._init = initVirtualComponent; VirtualComponent.prototype._update = updateVirtualComponent; vnode.componentOptions.Cto...
[ "function", "resolveVirtualComponent", "(", "vnode", ")", "{", "var", "BaseCtor", "=", "vnode", ".", "componentOptions", ".", "Ctor", ";", "var", "VirtualComponent", "=", "BaseCtor", ".", "extend", "(", "{", "}", ")", ";", "var", "cid", "=", "VirtualComponen...
listening on native callback
[ "listening", "on", "native", "callback" ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/factory.js#L4207-L4239
train
kaola-fed/megalo
packages/weex-vue-framework/index.js
createInstanceContext
function createInstanceContext ( instanceId, runtimeContext, data ) { if ( data === void 0 ) data = {}; var weex = runtimeContext.weex; var instance = instanceOptions[instanceId] = { instanceId: instanceId, config: weex.config, document: weex.document, data: data }; // Each instance ha...
javascript
function createInstanceContext ( instanceId, runtimeContext, data ) { if ( data === void 0 ) data = {}; var weex = runtimeContext.weex; var instance = instanceOptions[instanceId] = { instanceId: instanceId, config: weex.config, document: weex.document, data: data }; // Each instance ha...
[ "function", "createInstanceContext", "(", "instanceId", ",", "runtimeContext", ",", "data", ")", "{", "if", "(", "data", "===", "void", "0", ")", "data", "=", "{", "}", ";", "var", "weex", "=", "runtimeContext", ".", "weex", ";", "var", "instance", "=", ...
Create instance context.
[ "Create", "instance", "context", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/index.js#L16-L40
train
kaola-fed/megalo
packages/weex-vue-framework/index.js
getInstanceTimer
function getInstanceTimer ( instanceId, moduleGetter ) { var instance = instanceOptions[instanceId]; var timer = moduleGetter('timer'); var timerAPIs = { setTimeout: function () { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var handler = functi...
javascript
function getInstanceTimer ( instanceId, moduleGetter ) { var instance = instanceOptions[instanceId]; var timer = moduleGetter('timer'); var timerAPIs = { setTimeout: function () { var args = [], len = arguments.length; while ( len-- ) args[ len ] = arguments[ len ]; var handler = functi...
[ "function", "getInstanceTimer", "(", "instanceId", ",", "moduleGetter", ")", "{", "var", "instance", "=", "instanceOptions", "[", "instanceId", "]", ";", "var", "timer", "=", "moduleGetter", "(", "'timer'", ")", ";", "var", "timerAPIs", "=", "{", "setTimeout",...
DEPRECATED Generate HTML5 Timer APIs. An important point is that the callback will be converted into callback id when sent to native. So the framework can make sure no side effect of the callback happened after an instance destroyed.
[ "DEPRECATED", "Generate", "HTML5", "Timer", "APIs", ".", "An", "important", "point", "is", "that", "the", "callback", "will", "be", "converted", "into", "callback", "id", "when", "sent", "to", "native", ".", "So", "the", "framework", "can", "make", "sure", ...
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/weex-vue-framework/index.js#L162-L199
train
kaola-fed/megalo
packages/vue-server-renderer/build.dev.js
applyModelTransform
function applyModelTransform (el, state) { if (el.directives) { for (var i = 0; i < el.directives.length; i++) { var dir = el.directives[i]; if (dir.name === 'model') { state.directives.model(el, dir, state.warn); // remove value for textarea as its converted to text if (el.tag...
javascript
function applyModelTransform (el, state) { if (el.directives) { for (var i = 0; i < el.directives.length; i++) { var dir = el.directives[i]; if (dir.name === 'model') { state.directives.model(el, dir, state.warn); // remove value for textarea as its converted to text if (el.tag...
[ "function", "applyModelTransform", "(", "el", ",", "state", ")", "{", "if", "(", "el", ".", "directives", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "el", ".", "directives", ".", "length", ";", "i", "++", ")", "{", "var", "dir", ...
let the model AST transform translate v-model into appropriate props bindings
[ "let", "the", "model", "AST", "transform", "translate", "v", "-", "model", "into", "appropriate", "props", "bindings" ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/vue-server-renderer/build.dev.js#L5489-L5503
train
kaola-fed/megalo
dist/vue.esm.browser.js
isValidArrayIndex
function isValidArrayIndex (val) { const n = parseFloat(String(val)); return n >= 0 && Math.floor(n) === n && isFinite(val) }
javascript
function isValidArrayIndex (val) { const n = parseFloat(String(val)); return n >= 0 && Math.floor(n) === n && isFinite(val) }
[ "function", "isValidArrayIndex", "(", "val", ")", "{", "const", "n", "=", "parseFloat", "(", "String", "(", "val", ")", ")", ";", "return", "n", ">=", "0", "&&", "Math", ".", "floor", "(", "n", ")", "===", "n", "&&", "isFinite", "(", "val", ")", ...
Check if val is a valid array index.
[ "Check", "if", "val", "is", "a", "valid", "array", "index", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L74-L77
train
kaola-fed/megalo
dist/vue.esm.browser.js
makeMap
function makeMap ( str, expectsLowerCase ) { const map = Object.create(null); const list = str.split(','); for (let i = 0; i < list.length; i++) { map[list[i]] = true; } return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val] }
javascript
function makeMap ( str, expectsLowerCase ) { const map = Object.create(null); const list = str.split(','); for (let i = 0; i < list.length; i++) { map[list[i]] = true; } return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val] }
[ "function", "makeMap", "(", "str", ",", "expectsLowerCase", ")", "{", "const", "map", "=", "Object", ".", "create", "(", "null", ")", ";", "const", "list", "=", "str", ".", "split", "(", "','", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i"...
Make a map and return a function for checking if a key is in that map.
[ "Make", "a", "map", "and", "return", "a", "function", "for", "checking", "if", "a", "key", "is", "in", "that", "map", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L111-L123
train
kaola-fed/megalo
dist/vue.esm.browser.js
toArray
function toArray (list, start) { start = start || 0; let i = list.length - start; const ret = new Array(i); while (i--) { ret[i] = list[i + start]; } return ret }
javascript
function toArray (list, start) { start = start || 0; let i = list.length - start; const ret = new Array(i); while (i--) { ret[i] = list[i + start]; } return ret }
[ "function", "toArray", "(", "list", ",", "start", ")", "{", "start", "=", "start", "||", "0", ";", "let", "i", "=", "list", ".", "length", "-", "start", ";", "const", "ret", "=", "new", "Array", "(", "i", ")", ";", "while", "(", "i", "--", ")",...
Convert an Array-like object to a real Array.
[ "Convert", "an", "Array", "-", "like", "object", "to", "a", "real", "Array", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L223-L231
train
kaola-fed/megalo
dist/vue.esm.browser.js
cloneVNode
function cloneVNode (vnode) { const cloned = new VNode( vnode.tag, vnode.data, // #7975 // clone children array to avoid mutating original in case of cloning // a child. vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, ...
javascript
function cloneVNode (vnode) { const cloned = new VNode( vnode.tag, vnode.data, // #7975 // clone children array to avoid mutating original in case of cloning // a child. vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, ...
[ "function", "cloneVNode", "(", "vnode", ")", "{", "const", "cloned", "=", "new", "VNode", "(", "vnode", ".", "tag", ",", "vnode", ".", "data", ",", "// #7975", "// clone children array to avoid mutating original in case of cloning", "// a child.", "vnode", ".", "chi...
optimized shallow clone used for static nodes and slot nodes because they may be reused across multiple renders, cloning them avoids errors when DOM manipulations rely on their elm reference.
[ "optimized", "shallow", "clone", "used", "for", "static", "nodes", "and", "slot", "nodes", "because", "they", "may", "be", "reused", "across", "multiple", "renders", "cloning", "them", "avoids", "errors", "when", "DOM", "manipulations", "rely", "on", "their", ...
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L856-L880
train
kaola-fed/megalo
dist/vue.esm.browser.js
normalizeProps
function normalizeProps (options, vm) { const props = options.props; if (!props) return const res = {}; let i, val, name; if (Array.isArray(props)) { i = props.length; while (i--) { val = props[i]; if (typeof val === 'string') { name = camelize(val); res[name] = { type: nul...
javascript
function normalizeProps (options, vm) { const props = options.props; if (!props) return const res = {}; let i, val, name; if (Array.isArray(props)) { i = props.length; while (i--) { val = props[i]; if (typeof val === 'string') { name = camelize(val); res[name] = { type: nul...
[ "function", "normalizeProps", "(", "options", ",", "vm", ")", "{", "const", "props", "=", "options", ".", "props", ";", "if", "(", "!", "props", ")", "return", "const", "res", "=", "{", "}", ";", "let", "i", ",", "val", ",", "name", ";", "if", "(...
Ensure all props option syntax are normalized into the Object-based format.
[ "Ensure", "all", "props", "option", "syntax", "are", "normalized", "into", "the", "Object", "-", "based", "format", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L1461-L1493
train
kaola-fed/megalo
dist/vue.esm.browser.js
assertProp
function assertProp ( prop, name, value, vm, absent ) { if (prop.required && absent) { warn( 'Missing required prop: "' + name + '"', vm ); return } if (value == null && !prop.required) { return } let type = prop.type; let valid = !type || type === true; const expecte...
javascript
function assertProp ( prop, name, value, vm, absent ) { if (prop.required && absent) { warn( 'Missing required prop: "' + name + '"', vm ); return } if (value == null && !prop.required) { return } let type = prop.type; let valid = !type || type === true; const expecte...
[ "function", "assertProp", "(", "prop", ",", "name", ",", "value", ",", "vm", ",", "absent", ")", "{", "if", "(", "prop", ".", "required", "&&", "absent", ")", "{", "warn", "(", "'Missing required prop: \"'", "+", "name", "+", "'\"'", ",", "vm", ")", ...
Assert whether a prop is valid.
[ "Assert", "whether", "a", "prop", "is", "valid", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L1712-L1759
train
kaola-fed/megalo
dist/vue.esm.browser.js
checkKeyCodes
function checkKeyCodes ( eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName ) { const mappedKeyCode = config.keyCodes[key] || builtInKeyCode; if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { return isKeyNotMatch(builtInKeyName, eventKeyName) } else if (mappedKeyCode) { ...
javascript
function checkKeyCodes ( eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName ) { const mappedKeyCode = config.keyCodes[key] || builtInKeyCode; if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { return isKeyNotMatch(builtInKeyName, eventKeyName) } else if (mappedKeyCode) { ...
[ "function", "checkKeyCodes", "(", "eventKeyCode", ",", "key", ",", "builtInKeyCode", ",", "eventKeyName", ",", "builtInKeyName", ")", "{", "const", "mappedKeyCode", "=", "config", ".", "keyCodes", "[", "key", "]", "||", "builtInKeyCode", ";", "if", "(", "built...
Runtime helper for checking keyCodes from config. exposed as Vue.prototype._k passing in eventKeyName as last argument separately for backwards compat
[ "Runtime", "helper", "for", "checking", "keyCodes", "from", "config", ".", "exposed", "as", "Vue", ".", "prototype", ".", "_k", "passing", "in", "eventKeyName", "as", "last", "argument", "separately", "for", "backwards", "compat" ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L2735-L2750
train
kaola-fed/megalo
dist/vue.esm.browser.js
markOnce
function markOnce ( tree, index, key ) { markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true); return tree }
javascript
function markOnce ( tree, index, key ) { markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true); return tree }
[ "function", "markOnce", "(", "tree", ",", "index", ",", "key", ")", "{", "markStatic", "(", "tree", ",", "`", "${", "index", "}", "${", "key", "?", "`", "${", "key", "}", "`", ":", "`", "`", "}", "`", ",", "true", ")", ";", "return", "tree", ...
Runtime helper for v-once. Effectively it means marking the node as static with a unique key.
[ "Runtime", "helper", "for", "v", "-", "once", ".", "Effectively", "it", "means", "marking", "the", "node", "as", "static", "with", "a", "unique", "key", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L2835-L2842
train
kaola-fed/megalo
dist/vue.esm.browser.js
getOuterHTML
function getOuterHTML (el) { if (el.outerHTML) { return el.outerHTML } else { const container = document.createElement('div'); container.appendChild(el.cloneNode(true)); return container.innerHTML } }
javascript
function getOuterHTML (el) { if (el.outerHTML) { return el.outerHTML } else { const container = document.createElement('div'); container.appendChild(el.cloneNode(true)); return container.innerHTML } }
[ "function", "getOuterHTML", "(", "el", ")", "{", "if", "(", "el", ".", "outerHTML", ")", "{", "return", "el", ".", "outerHTML", "}", "else", "{", "const", "container", "=", "document", ".", "createElement", "(", "'div'", ")", ";", "container", ".", "ap...
Get outerHTML of elements, taking care of SVG elements in IE as well.
[ "Get", "outerHTML", "of", "elements", "taking", "care", "of", "SVG", "elements", "in", "IE", "as", "well", "." ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/dist/vue.esm.browser.js#L11892-L11900
train
kaola-fed/megalo
packages/megalo-template-compiler/build.js
mpify
function mpify (node, options) { var target = options.target; if ( target === void 0 ) target = 'wechat'; var imports = options.imports; if ( imports === void 0 ) imports = {}; var transformAssetUrls = options.transformAssetUrls; if ( transformAssetUrls === void 0 ) transformAssetUrls = {}; var scopeId = option...
javascript
function mpify (node, options) { var target = options.target; if ( target === void 0 ) target = 'wechat'; var imports = options.imports; if ( imports === void 0 ) imports = {}; var transformAssetUrls = options.transformAssetUrls; if ( transformAssetUrls === void 0 ) transformAssetUrls = {}; var scopeId = option...
[ "function", "mpify", "(", "node", ",", "options", ")", "{", "var", "target", "=", "options", ".", "target", ";", "if", "(", "target", "===", "void", "0", ")", "target", "=", "'wechat'", ";", "var", "imports", "=", "options", ".", "imports", ";", "if"...
walk and modify ast before render function is generated
[ "walk", "and", "modify", "ast", "before", "render", "function", "is", "generated" ]
c5d971837c3467430469351084e0df9e4da34c4d
https://github.com/kaola-fed/megalo/blob/c5d971837c3467430469351084e0df9e4da34c4d/packages/megalo-template-compiler/build.js#L5227-L5246
train
apache/cordova-plugin-statusbar
src/windows/StatusBarProxy.js
isSupported
function isSupported() { // if not checked before, run check if (_supported === null) { var viewMan = Windows.UI.ViewManagement; _supported = (viewMan.StatusBar && viewMan.StatusBar.getForCurrentView); } return _supported; }
javascript
function isSupported() { // if not checked before, run check if (_supported === null) { var viewMan = Windows.UI.ViewManagement; _supported = (viewMan.StatusBar && viewMan.StatusBar.getForCurrentView); } return _supported; }
[ "function", "isSupported", "(", ")", "{", "// if not checked before, run check", "if", "(", "_supported", "===", "null", ")", "{", "var", "viewMan", "=", "Windows", ".", "UI", ".", "ViewManagement", ";", "_supported", "=", "(", "viewMan", ".", "StatusBar", "&&...
set to null so we can check first time
[ "set", "to", "null", "so", "we", "can", "check", "first", "time" ]
003fa610307f0d2b68aed2cebdc04a939d77912f
https://github.com/apache/cordova-plugin-statusbar/blob/003fa610307f0d2b68aed2cebdc04a939d77912f/src/windows/StatusBarProxy.js#L25-L32
train
aholstenson/miio
lib/devices/gateway.js
generateKey
function generateKey() { let result = ''; for(let i=0; i<16; i++) { let idx = Math.floor(Math.random() * CHARS.length); result += CHARS[idx]; } return result; }
javascript
function generateKey() { let result = ''; for(let i=0; i<16; i++) { let idx = Math.floor(Math.random() * CHARS.length); result += CHARS[idx]; } return result; }
[ "function", "generateKey", "(", ")", "{", "let", "result", "=", "''", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "16", ";", "i", "++", ")", "{", "let", "idx", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", ...
Generate a key for use with the local developer API. This does not generate a secure key, but the Mi Home app does not seem to do that either.
[ "Generate", "a", "key", "for", "use", "with", "the", "local", "developer", "API", ".", "This", "does", "not", "generate", "a", "secure", "key", "but", "the", "Mi", "Home", "app", "does", "not", "seem", "to", "do", "that", "either", "." ]
dbd66fd9c6ebe7a206eb202624c268a1d77424d0
https://github.com/aholstenson/miio/blob/dbd66fd9c6ebe7a206eb202624c268a1d77424d0/lib/devices/gateway.js#L20-L27
train
aholstenson/miio
lib/devices/capabilities/sensor.js
mixin
function mixin(device, options) { if(device.capabilities.indexOf('sensor') < 0) { device.capabilities.push('sensor'); } device.capabilities.push(options.name); Object.defineProperty(device, options.name, { get: function() { return this.property(options.name); } }); }
javascript
function mixin(device, options) { if(device.capabilities.indexOf('sensor') < 0) { device.capabilities.push('sensor'); } device.capabilities.push(options.name); Object.defineProperty(device, options.name, { get: function() { return this.property(options.name); } }); }
[ "function", "mixin", "(", "device", ",", "options", ")", "{", "if", "(", "device", ".", "capabilities", ".", "indexOf", "(", "'sensor'", ")", "<", "0", ")", "{", "device", ".", "capabilities", ".", "push", "(", "'sensor'", ")", ";", "}", "device", "....
Setup sensor support for a device.
[ "Setup", "sensor", "support", "for", "a", "device", "." ]
dbd66fd9c6ebe7a206eb202624c268a1d77424d0
https://github.com/aholstenson/miio/blob/dbd66fd9c6ebe7a206eb202624c268a1d77424d0/lib/devices/capabilities/sensor.js#L37-L48
train
bpmn-io/diagram-js
lib/features/grid-snapping/GridSnapping.js
getSnapOffset
function getSnapOffset(event, axis) { var context = event.context, shape = event.shape, gridSnappingContext = context.gridSnappingContext || {}, snapLocation = gridSnappingContext.snapLocation; if (!shape || !snapLocation) { return 0; } if (axis === 'x') { if (/left/.test(...
javascript
function getSnapOffset(event, axis) { var context = event.context, shape = event.shape, gridSnappingContext = context.gridSnappingContext || {}, snapLocation = gridSnappingContext.snapLocation; if (!shape || !snapLocation) { return 0; } if (axis === 'x') { if (/left/.test(...
[ "function", "getSnapOffset", "(", "event", ",", "axis", ")", "{", "var", "context", "=", "event", ".", "context", ",", "shape", "=", "event", ".", "shape", ",", "gridSnappingContext", "=", "context", ".", "gridSnappingContext", "||", "{", "}", ",", "snapLo...
Get snap offset assuming that event is at center of shape. @param {Object} event @param {string} axis @returns {number}
[ "Get", "snap", "offset", "assuming", "that", "event", "is", "at", "center", "of", "shape", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/grid-snapping/GridSnapping.js#L253-L282
train
bpmn-io/diagram-js
lib/features/attach-support/AttachSupport.js
removeAttached
function removeAttached(elements) { var ids = groupBy(elements, 'id'); return filter(elements, function(element) { while (element) { // host in selection if (element.host && ids[element.host.id]) { return false; } element = element.parent; } return true; }); }
javascript
function removeAttached(elements) { var ids = groupBy(elements, 'id'); return filter(elements, function(element) { while (element) { // host in selection if (element.host && ids[element.host.id]) { return false; } element = element.parent; } return true; }); }
[ "function", "removeAttached", "(", "elements", ")", "{", "var", "ids", "=", "groupBy", "(", "elements", ",", "'id'", ")", ";", "return", "filter", "(", "elements", ",", "function", "(", "element", ")", "{", "while", "(", "element", ")", "{", "// host in ...
Return a filtered list of elements that do not contain attached elements with hosts being part of the selection. @param {Array<djs.model.Base>} elements @return {Array<djs.model.Base>} filtered
[ "Return", "a", "filtered", "list", "of", "elements", "that", "do", "not", "contain", "attached", "elements", "with", "hosts", "being", "part", "of", "the", "selection", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/attach-support/AttachSupport.js#L309-L326
train
bpmn-io/diagram-js
lib/features/move/Move.js
start
function start(event, element, activate, context) { if (isObject(activate)) { context = activate; activate = false; } // do not move connections or the root element if (element.waypoints || !element.parent) { return; } var referencePoint = mid(element); dragging.init(eve...
javascript
function start(event, element, activate, context) { if (isObject(activate)) { context = activate; activate = false; } // do not move connections or the root element if (element.waypoints || !element.parent) { return; } var referencePoint = mid(element); dragging.init(eve...
[ "function", "start", "(", "event", ",", "element", ",", "activate", ",", "context", ")", "{", "if", "(", "isObject", "(", "activate", ")", ")", "{", "context", "=", "activate", ";", "activate", "=", "false", ";", "}", "// do not move connections or the root ...
Start move. @param {MouseEvent} event @param {djs.model.Shape} shape @param {boolean} [activate] @param {Object} [context]
[ "Start", "move", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/move/Move.js#L180-L204
train
bpmn-io/diagram-js
lib/features/move/Move.js
removeNested
function removeNested(elements) { var ids = groupBy(elements, 'id'); return filter(elements, function(element) { while ((element = element.parent)) { // parent in selection if (ids[element.id]) { return false; } } return true; }); }
javascript
function removeNested(elements) { var ids = groupBy(elements, 'id'); return filter(elements, function(element) { while ((element = element.parent)) { // parent in selection if (ids[element.id]) { return false; } } return true; }); }
[ "function", "removeNested", "(", "elements", ")", "{", "var", "ids", "=", "groupBy", "(", "elements", ",", "'id'", ")", ";", "return", "filter", "(", "elements", ",", "function", "(", "element", ")", "{", "while", "(", "(", "element", "=", "element", "...
Return a filtered list of elements that do not contain those nested into others. @param {Array<djs.model.Base>} elements @return {Array<djs.model.Base>} filtered
[ "Return", "a", "filtered", "list", "of", "elements", "that", "do", "not", "contain", "those", "nested", "into", "others", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/move/Move.js#L228-L243
train
bpmn-io/diagram-js
lib/features/move/MovePreview.js
setMarker
function setMarker(element, marker) { [ MARKER_ATTACH, MARKER_OK, MARKER_NOT_OK, MARKER_NEW_PARENT ].forEach(function(m) { if (m === marker) { canvas.addMarker(element, m); } else { canvas.removeMarker(element, m); } }); }
javascript
function setMarker(element, marker) { [ MARKER_ATTACH, MARKER_OK, MARKER_NOT_OK, MARKER_NEW_PARENT ].forEach(function(m) { if (m === marker) { canvas.addMarker(element, m); } else { canvas.removeMarker(element, m); } }); }
[ "function", "setMarker", "(", "element", ",", "marker", ")", "{", "[", "MARKER_ATTACH", ",", "MARKER_OK", ",", "MARKER_NOT_OK", ",", "MARKER_NEW_PARENT", "]", ".", "forEach", "(", "function", "(", "m", ")", "{", "if", "(", "m", "===", "marker", ")", "{",...
Sets drop marker on an element.
[ "Sets", "drop", "marker", "on", "an", "element", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/move/MovePreview.js#L66-L76
train
bpmn-io/diagram-js
lib/features/move/MovePreview.js
makeDraggable
function makeDraggable(context, element, addMarker) { previewSupport.addDragger(element, context.dragGroup); if (addMarker) { canvas.addMarker(element, MARKER_DRAGGING); } if (context.allDraggedElements) { context.allDraggedElements.push(element); } else { context.allDraggedElem...
javascript
function makeDraggable(context, element, addMarker) { previewSupport.addDragger(element, context.dragGroup); if (addMarker) { canvas.addMarker(element, MARKER_DRAGGING); } if (context.allDraggedElements) { context.allDraggedElements.push(element); } else { context.allDraggedElem...
[ "function", "makeDraggable", "(", "context", ",", "element", ",", "addMarker", ")", "{", "previewSupport", ".", "addDragger", "(", "element", ",", "context", ".", "dragGroup", ")", ";", "if", "(", "addMarker", ")", "{", "canvas", ".", "addMarker", "(", "el...
Make an element draggable. @param {Object} context @param {djs.model.Base} element @param {Boolean} addMarker
[ "Make", "an", "element", "draggable", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/move/MovePreview.js#L85-L98
train
bpmn-io/diagram-js
lib/features/search-pad/SearchPad.js
constructOverlay
function constructOverlay(box) { var offset = 6; var w = box.width + offset * 2; var h = box.height + offset * 2; var styles = [ 'width: '+ w +'px', 'height: '+ h + 'px' ].join('; '); return { position: { bottom: h - offset, right: w - offset }, show: true, html: '<div...
javascript
function constructOverlay(box) { var offset = 6; var w = box.width + offset * 2; var h = box.height + offset * 2; var styles = [ 'width: '+ w +'px', 'height: '+ h + 'px' ].join('; '); return { position: { bottom: h - offset, right: w - offset }, show: true, html: '<div...
[ "function", "constructOverlay", "(", "box", ")", "{", "var", "offset", "=", "6", ";", "var", "w", "=", "box", ".", "width", "+", "offset", "*", "2", ";", "var", "h", "=", "box", ".", "height", "+", "offset", "*", "2", ";", "var", "styles", "=", ...
Construct overlay object for the given bounding box. @param {BoundingBox} box @return {Object}
[ "Construct", "overlay", "object", "for", "the", "given", "bounding", "box", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/search-pad/SearchPad.js#L462-L481
train
bpmn-io/diagram-js
lib/features/search-pad/SearchPad.js
createInnerTextNode
function createInnerTextNode(parentNode, tokens, template) { var text = createHtmlText(tokens); var childNode = domify(template); childNode.innerHTML = text; parentNode.appendChild(childNode); }
javascript
function createInnerTextNode(parentNode, tokens, template) { var text = createHtmlText(tokens); var childNode = domify(template); childNode.innerHTML = text; parentNode.appendChild(childNode); }
[ "function", "createInnerTextNode", "(", "parentNode", ",", "tokens", ",", "template", ")", "{", "var", "text", "=", "createHtmlText", "(", "tokens", ")", ";", "var", "childNode", "=", "domify", "(", "template", ")", ";", "childNode", ".", "innerHTML", "=", ...
Creates and appends child node from result tokens and HTML template. @param {Element} node @param {Array<Object>} tokens @param {String} template
[ "Creates", "and", "appends", "child", "node", "from", "result", "tokens", "and", "HTML", "template", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/search-pad/SearchPad.js#L491-L496
train
bpmn-io/diagram-js
lib/features/search-pad/SearchPad.js
createHtmlText
function createHtmlText(tokens) { var htmlText = ''; tokens.forEach(function(t) { if (t.matched) { htmlText += '<strong class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + t.matched + '</strong>'; } else { htmlText += t.normal; } }); return htmlText !== '' ? htmlText : null; }
javascript
function createHtmlText(tokens) { var htmlText = ''; tokens.forEach(function(t) { if (t.matched) { htmlText += '<strong class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + t.matched + '</strong>'; } else { htmlText += t.normal; } }); return htmlText !== '' ? htmlText : null; }
[ "function", "createHtmlText", "(", "tokens", ")", "{", "var", "htmlText", "=", "''", ";", "tokens", ".", "forEach", "(", "function", "(", "t", ")", "{", "if", "(", "t", ".", "matched", ")", "{", "htmlText", "+=", "'<strong class=\"'", "+", "SearchPad", ...
Create internal HTML markup from result tokens. Caters for highlighting pattern matched tokens. @param {Array<Object>} tokens @return {String}
[ "Create", "internal", "HTML", "markup", "from", "result", "tokens", ".", "Caters", "for", "highlighting", "pattern", "matched", "tokens", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/search-pad/SearchPad.js#L505-L517
train
bpmn-io/diagram-js
lib/util/Text.js
layoutNext
function layoutNext(lines, maxWidth, fakeText) { var originalLine = lines.shift(), fitLine = originalLine; var textBBox; for (;;) { textBBox = getTextBBox(fitLine, fakeText); textBBox.width = fitLine ? textBBox.width : 0; // try to fit if (fitLine === ' ' || fitLine === '' || textBBox.w...
javascript
function layoutNext(lines, maxWidth, fakeText) { var originalLine = lines.shift(), fitLine = originalLine; var textBBox; for (;;) { textBBox = getTextBBox(fitLine, fakeText); textBBox.width = fitLine ? textBBox.width : 0; // try to fit if (fitLine === ' ' || fitLine === '' || textBBox.w...
[ "function", "layoutNext", "(", "lines", ",", "maxWidth", ",", "fakeText", ")", "{", "var", "originalLine", "=", "lines", ".", "shift", "(", ")", ",", "fitLine", "=", "originalLine", ";", "var", "textBBox", ";", "for", "(", ";", ";", ")", "{", "textBBox...
Layout the next line and return the layouted element. Alters the lines passed. @param {Array<String>} lines @return {Object} the line descriptor, an object { width, height, text }
[ "Layout", "the", "next", "line", "and", "return", "the", "layouted", "element", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/util/Text.js#L90-L109
train
bpmn-io/diagram-js
lib/util/Text.js
semanticShorten
function semanticShorten(line, maxLength) { var parts = line.split(/(\s|-)/g), part, shortenedParts = [], length = 0; // try to shorten via spaces + hyphens if (parts.length > 1) { while ((part = parts.shift())) { if (part.length + length < maxLength) { shortenedParts.push(par...
javascript
function semanticShorten(line, maxLength) { var parts = line.split(/(\s|-)/g), part, shortenedParts = [], length = 0; // try to shorten via spaces + hyphens if (parts.length > 1) { while ((part = parts.shift())) { if (part.length + length < maxLength) { shortenedParts.push(par...
[ "function", "semanticShorten", "(", "line", ",", "maxLength", ")", "{", "var", "parts", "=", "line", ".", "split", "(", "/", "(\\s|-)", "/", "g", ")", ",", "part", ",", "shortenedParts", "=", "[", "]", ",", "length", "=", "0", ";", "// try to shorten v...
Shortens a line based on spacing and hyphens. Returns the shortened result on success. @param {String} line @param {Number} maxLength the maximum characters of the string @return {String} the shortened string
[ "Shortens", "a", "line", "based", "on", "spacing", "and", "hyphens", ".", "Returns", "the", "shortened", "result", "on", "success", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/util/Text.js#L134-L158
train
bpmn-io/diagram-js
lib/layout/ManhattanLayout.js
getSimpleBendpoints
function getSimpleBendpoints(a, b, directions) { var xmid = round((b.x - a.x) / 2 + a.x), ymid = round((b.y - a.y) / 2 + a.y); // one point, right or left from a if (directions === 'h:v') { return [ { x: b.x, y: a.y } ]; } // one point, above or below a if (directions === 'v:h') { return [ ...
javascript
function getSimpleBendpoints(a, b, directions) { var xmid = round((b.x - a.x) / 2 + a.x), ymid = round((b.y - a.y) / 2 + a.y); // one point, right or left from a if (directions === 'h:v') { return [ { x: b.x, y: a.y } ]; } // one point, above or below a if (directions === 'v:h') { return [ ...
[ "function", "getSimpleBendpoints", "(", "a", ",", "b", ",", "directions", ")", "{", "var", "xmid", "=", "round", "(", "(", "b", ".", "x", "-", "a", ".", "x", ")", "/", "2", "+", "a", ".", "x", ")", ",", "ymid", "=", "round", "(", "(", "b", ...
Handle simple layouts with maximum two bendpoints.
[ "Handle", "simple", "layouts", "with", "maximum", "two", "bendpoints", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L161-L193
train
bpmn-io/diagram-js
lib/layout/ManhattanLayout.js
getBendpoints
function getBendpoints(a, b, directions) { directions = directions || 'h:h'; if (!isValidDirections(directions)) { throw new Error( 'unknown directions: <' + directions + '>: ' + 'must be specified as <start>:<end> ' + 'with start/end in { h,v,t,r,b,l }' ); } // compute explicit dire...
javascript
function getBendpoints(a, b, directions) { directions = directions || 'h:h'; if (!isValidDirections(directions)) { throw new Error( 'unknown directions: <' + directions + '>: ' + 'must be specified as <start>:<end> ' + 'with start/end in { h,v,t,r,b,l }' ); } // compute explicit dire...
[ "function", "getBendpoints", "(", "a", ",", "b", ",", "directions", ")", "{", "directions", "=", "directions", "||", "'h:h'", ";", "if", "(", "!", "isValidDirections", "(", "directions", ")", ")", "{", "throw", "new", "Error", "(", "'unknown directions: <'",...
Returns the mid points for a manhattan connection between two points. @example h:h (horizontal:horizontal) [a]----[x] | [x]----[b] @example h:v (horizontal:vertical) [a]----[x] | [b] @example h:r (horizontal:right) [a]----[x] | [b]-[x] @param {Point} a @param {Point} b @param {String} directions @return {Arr...
[ "Returns", "the", "mid", "points", "for", "a", "manhattan", "connection", "between", "two", "points", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L223-L250
train
bpmn-io/diagram-js
lib/layout/ManhattanLayout.js
tryRepairConnectionStart
function tryRepairConnectionStart(moved, other, newDocking, points) { return _tryRepairConnectionSide(moved, other, newDocking, points); }
javascript
function tryRepairConnectionStart(moved, other, newDocking, points) { return _tryRepairConnectionSide(moved, other, newDocking, points); }
[ "function", "tryRepairConnectionStart", "(", "moved", ",", "other", ",", "newDocking", ",", "points", ")", "{", "return", "_tryRepairConnectionSide", "(", "moved", ",", "other", ",", "newDocking", ",", "points", ")", ";", "}" ]
Repair a connection from start. @param {Bounds} moved @param {Bounds} other @param {Point} newDocking @param {Array<Point>} points originalPoints from moved to other @return {Array<Point>|null} the repaired points between the two rectangles
[ "Repair", "a", "connection", "from", "start", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L488-L490
train
bpmn-io/diagram-js
lib/layout/ManhattanLayout.js
tryRepairConnectionEnd
function tryRepairConnectionEnd(moved, other, newDocking, points) { var waypoints = points.slice().reverse(); waypoints = _tryRepairConnectionSide(moved, other, newDocking, waypoints); return waypoints ? waypoints.reverse() : null; }
javascript
function tryRepairConnectionEnd(moved, other, newDocking, points) { var waypoints = points.slice().reverse(); waypoints = _tryRepairConnectionSide(moved, other, newDocking, waypoints); return waypoints ? waypoints.reverse() : null; }
[ "function", "tryRepairConnectionEnd", "(", "moved", ",", "other", ",", "newDocking", ",", "points", ")", "{", "var", "waypoints", "=", "points", ".", "slice", "(", ")", ".", "reverse", "(", ")", ";", "waypoints", "=", "_tryRepairConnectionSide", "(", "moved"...
Repair a connection from end. @param {Bounds} moved @param {Bounds} other @param {Point} newDocking @param {Array<Point>} points originalPoints from moved to other @return {Array<Point>|null} the repaired points between the two rectangles
[ "Repair", "a", "connection", "from", "end", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L502-L508
train
bpmn-io/diagram-js
lib/layout/ManhattanLayout.js
_tryRepairConnectionSide
function _tryRepairConnectionSide(moved, other, newDocking, points) { function needsRelayout(moved, other, points) { if (points.length < 3) { return true; } if (points.length > 4) { return false; } // relayout if two points overlap // this is most likely due to return !!fin...
javascript
function _tryRepairConnectionSide(moved, other, newDocking, points) { function needsRelayout(moved, other, points) { if (points.length < 3) { return true; } if (points.length > 4) { return false; } // relayout if two points overlap // this is most likely due to return !!fin...
[ "function", "_tryRepairConnectionSide", "(", "moved", ",", "other", ",", "newDocking", ",", "points", ")", "{", "function", "needsRelayout", "(", "moved", ",", "other", ",", "points", ")", "{", "if", "(", "points", ".", "length", "<", "3", ")", "{", "ret...
Repair a connection from one side that moved. @param {Bounds} moved @param {Bounds} other @param {Point} newDocking @param {Array<Point>} points originalPoints from moved to other @return {Array<Point>} the repaired points between the two rectangles
[ "Repair", "a", "connection", "from", "one", "side", "that", "moved", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/layout/ManhattanLayout.js#L520-L604
train
bpmn-io/diagram-js
lib/core/Canvas.js
createContainer
function createContainer(options) { options = assign({}, { width: '100%', height: '100%' }, options); var container = options.container || document.body; // create a <div> around the svg element with the respective size // this way we can always get the correct container size // (this is impossible for <sv...
javascript
function createContainer(options) { options = assign({}, { width: '100%', height: '100%' }, options); var container = options.container || document.body; // create a <div> around the svg element with the respective size // this way we can always get the correct container size // (this is impossible for <sv...
[ "function", "createContainer", "(", "options", ")", "{", "options", "=", "assign", "(", "{", "}", ",", "{", "width", ":", "'100%'", ",", "height", ":", "'100%'", "}", ",", "options", ")", ";", "var", "container", "=", "options", ".", "container", "||",...
Creates a HTML container element for a SVG element with the given configuration @param {Object} options @return {HTMLElement} the container element
[ "Creates", "a", "HTML", "container", "element", "for", "a", "SVG", "element", "with", "the", "given", "configuration" ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/core/Canvas.js#L46-L68
train
bpmn-io/diagram-js
lib/features/resize/Resize.js
handleMove
function handleMove(context, delta) { var shape = context.shape, direction = context.direction, resizeConstraints = context.resizeConstraints, newBounds; context.delta = delta; newBounds = resizeBounds(shape, direction, delta); // ensure constraints during resize context....
javascript
function handleMove(context, delta) { var shape = context.shape, direction = context.direction, resizeConstraints = context.resizeConstraints, newBounds; context.delta = delta; newBounds = resizeBounds(shape, direction, delta); // ensure constraints during resize context....
[ "function", "handleMove", "(", "context", ",", "delta", ")", "{", "var", "shape", "=", "context", ".", "shape", ",", "direction", "=", "context", ".", "direction", ",", "resizeConstraints", "=", "context", ".", "resizeConstraints", ",", "newBounds", ";", "co...
Handle resize move by specified delta. @param {Object} context @param {Point} delta
[ "Handle", "resize", "move", "by", "specified", "delta", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/resize/Resize.js#L72-L88
train
bpmn-io/diagram-js
lib/features/resize/Resize.js
handleStart
function handleStart(context) { var resizeConstraints = context.resizeConstraints, // evaluate minBounds for backwards compatibility minBounds = context.minBounds; if (resizeConstraints !== undefined) { return; } if (minBounds === undefined) { minBounds = self.computeMinRe...
javascript
function handleStart(context) { var resizeConstraints = context.resizeConstraints, // evaluate minBounds for backwards compatibility minBounds = context.minBounds; if (resizeConstraints !== undefined) { return; } if (minBounds === undefined) { minBounds = self.computeMinRe...
[ "function", "handleStart", "(", "context", ")", "{", "var", "resizeConstraints", "=", "context", ".", "resizeConstraints", ",", "// evaluate minBounds for backwards compatibility", "minBounds", "=", "context", ".", "minBounds", ";", "if", "(", "resizeConstraints", "!=="...
Handle resize start. @param {Object} context
[ "Handle", "resize", "start", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/resize/Resize.js#L95-L112
train
bpmn-io/diagram-js
lib/features/resize/Resize.js
handleEnd
function handleEnd(context) { var shape = context.shape, canExecute = context.canExecute, newBounds = context.newBounds; if (canExecute) { // ensure we have actual pixel values for new bounds // (important when zoom level was > 1 during move) newBounds = roundBounds(newBounds)...
javascript
function handleEnd(context) { var shape = context.shape, canExecute = context.canExecute, newBounds = context.newBounds; if (canExecute) { // ensure we have actual pixel values for new bounds // (important when zoom level was > 1 during move) newBounds = roundBounds(newBounds)...
[ "function", "handleEnd", "(", "context", ")", "{", "var", "shape", "=", "context", ".", "shape", ",", "canExecute", "=", "context", ".", "canExecute", ",", "newBounds", "=", "context", ".", "newBounds", ";", "if", "(", "canExecute", ")", "{", "// ensure we...
Handle resize end. @param {Object} context
[ "Handle", "resize", "end", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/resize/Resize.js#L119-L132
train
bpmn-io/diagram-js
lib/Diagram.js
bootstrap
function bootstrap(bootstrapModules) { var modules = [], components = []; function hasModule(m) { return modules.indexOf(m) >= 0; } function addModule(m) { modules.push(m); } function visit(m) { if (hasModule(m)) { return; } (m.__depends__ || []).forEach(visit); if ...
javascript
function bootstrap(bootstrapModules) { var modules = [], components = []; function hasModule(m) { return modules.indexOf(m) >= 0; } function addModule(m) { modules.push(m); } function visit(m) { if (hasModule(m)) { return; } (m.__depends__ || []).forEach(visit); if ...
[ "function", "bootstrap", "(", "bootstrapModules", ")", "{", "var", "modules", "=", "[", "]", ",", "components", "=", "[", "]", ";", "function", "hasModule", "(", "m", ")", "{", "return", "modules", ".", "indexOf", "(", "m", ")", ">=", "0", ";", "}", ...
Bootstrap an injector from a list of modules, instantiating a number of default components @ignore @param {Array<didi.Module>} bootstrapModules @return {didi.Injector} a injector to use to access the components
[ "Bootstrap", "an", "injector", "from", "a", "list", "of", "modules", "instantiating", "a", "number", "of", "default", "components" ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/Diagram.js#L14-L63
train
bpmn-io/diagram-js
lib/Diagram.js
createInjector
function createInjector(options) { options = options || {}; var configModule = { 'config': ['value', options] }; var modules = [ configModule, CoreModule ].concat(options.modules || []); return bootstrap(modules); }
javascript
function createInjector(options) { options = options || {}; var configModule = { 'config': ['value', options] }; var modules = [ configModule, CoreModule ].concat(options.modules || []); return bootstrap(modules); }
[ "function", "createInjector", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "var", "configModule", "=", "{", "'config'", ":", "[", "'value'", ",", "options", "]", "}", ";", "var", "modules", "=", "[", "configModule", ",", "C...
Creates an injector from passed options. @ignore @param {Object} options @return {didi.Injector}
[ "Creates", "an", "injector", "from", "passed", "options", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/Diagram.js#L72-L83
train
bpmn-io/diagram-js
lib/features/dragging/Dragging.js
trapClickAndEnd
function trapClickAndEnd(event) { var untrap; // trap the click in case we are part of an active // drag operation. This will effectively prevent // the ghost click that cannot be canceled otherwise. if (context.active) { untrap = installClickTrap(eventBus); // remove trap after mini...
javascript
function trapClickAndEnd(event) { var untrap; // trap the click in case we are part of an active // drag operation. This will effectively prevent // the ghost click that cannot be canceled otherwise. if (context.active) { untrap = installClickTrap(eventBus); // remove trap after mini...
[ "function", "trapClickAndEnd", "(", "event", ")", "{", "var", "untrap", ";", "// trap the click in case we are part of an active", "// drag operation. This will effectively prevent", "// the ghost click that cannot be canceled otherwise.", "if", "(", "context", ".", "active", ")", ...
prevent ghost click that might occur after a finished drag and drop session
[ "prevent", "ghost", "click", "that", "might", "occur", "after", "a", "finished", "drag", "and", "drop", "session" ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/dragging/Dragging.js#L289-L308
train
bpmn-io/diagram-js
lib/features/dragging/Dragging.js
cancel
function cancel(restore) { var previousContext; if (!context) { return; } var wasActive = context.active; if (wasActive) { fire('cancel'); } previousContext = cleanup(restore); if (wasActive) { // last event to be fired when all drag operations are done // at...
javascript
function cancel(restore) { var previousContext; if (!context) { return; } var wasActive = context.active; if (wasActive) { fire('cancel'); } previousContext = cleanup(restore); if (wasActive) { // last event to be fired when all drag operations are done // at...
[ "function", "cancel", "(", "restore", ")", "{", "var", "previousContext", ";", "if", "(", "!", "context", ")", "{", "return", ";", "}", "var", "wasActive", "=", "context", ".", "active", ";", "if", "(", "wasActive", ")", "{", "fire", "(", "'cancel'", ...
life-cycle methods
[ "life", "-", "cycle", "methods" ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/dragging/Dragging.js#L339-L359
train
bpmn-io/diagram-js
lib/features/dragging/Dragging.js
init
function init(event, relativeTo, prefix, options) { // only one drag operation may be active, at a time if (context) { cancel(false); } if (typeof relativeTo === 'string') { options = prefix; prefix = relativeTo; relativeTo = null; } options = assign({}, defaultOptions...
javascript
function init(event, relativeTo, prefix, options) { // only one drag operation may be active, at a time if (context) { cancel(false); } if (typeof relativeTo === 'string') { options = prefix; prefix = relativeTo; relativeTo = null; } options = assign({}, defaultOptions...
[ "function", "init", "(", "event", ",", "relativeTo", ",", "prefix", ",", "options", ")", "{", "// only one drag operation may be active, at a time", "if", "(", "context", ")", "{", "cancel", "(", "false", ")", ";", "}", "if", "(", "typeof", "relativeTo", "==="...
Initialize a drag operation. If `localPosition` is given, drag events will be emitted relative to it. @param {MouseEvent|TouchEvent} [event] @param {Point} [localPosition] actual diagram local position this drag operation should start at @param {String} prefix @param {Object} [options]
[ "Initialize", "a", "drag", "operation", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/dragging/Dragging.js#L423-L518
train
bpmn-io/diagram-js
lib/features/bendpoints/ConnectionSegmentMove.js
getDocking
function getDocking(point, referenceElement, moveAxis) { var referenceMid, inverseAxis; if (point.original) { return point.original; } else { referenceMid = getMid(referenceElement); inverseAxis = flipAxis(moveAxis); return axisSet(point, inverseAxis, referenceMid[inverseAxis]); } }
javascript
function getDocking(point, referenceElement, moveAxis) { var referenceMid, inverseAxis; if (point.original) { return point.original; } else { referenceMid = getMid(referenceElement); inverseAxis = flipAxis(moveAxis); return axisSet(point, inverseAxis, referenceMid[inverseAxis]); } }
[ "function", "getDocking", "(", "point", ",", "referenceElement", ",", "moveAxis", ")", "{", "var", "referenceMid", ",", "inverseAxis", ";", "if", "(", "point", ".", "original", ")", "{", "return", "point", ".", "original", ";", "}", "else", "{", "reference...
Get the docking point on the given element. Compute a reasonable docking, if non exists. @param {Point} point @param {djs.model.Shape} referenceElement @param {String} moveAxis (x|y) @return {Point}
[ "Get", "the", "docking", "point", "on", "the", "given", "element", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/bendpoints/ConnectionSegmentMove.js#L66-L79
train
bpmn-io/diagram-js
lib/features/bendpoints/ConnectionSegmentMove.js
cropConnection
function cropConnection(connection, newWaypoints) { // crop connection, if docking service is provided only if (!connectionDocking) { return newWaypoints; } var oldWaypoints = connection.waypoints, croppedWaypoints; // temporary set new waypoints connection.waypoints = newWaypoi...
javascript
function cropConnection(connection, newWaypoints) { // crop connection, if docking service is provided only if (!connectionDocking) { return newWaypoints; } var oldWaypoints = connection.waypoints, croppedWaypoints; // temporary set new waypoints connection.waypoints = newWaypoi...
[ "function", "cropConnection", "(", "connection", ",", "newWaypoints", ")", "{", "// crop connection, if docking service is provided only", "if", "(", "!", "connectionDocking", ")", "{", "return", "newWaypoints", ";", "}", "var", "oldWaypoints", "=", "connection", ".", ...
Crop connection if connection cropping is provided. @param {Connection} connection @param {Array<Point>} newWaypoints @return {Array<Point>} cropped connection waypoints
[ "Crop", "connection", "if", "connection", "cropping", "is", "provided", "." ]
fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde
https://github.com/bpmn-io/diagram-js/blob/fe4918cc1fefa3f5cd8e946cb9fff44e7ebb4cde/lib/features/bendpoints/ConnectionSegmentMove.js#L155-L174
train
Akryum/v-tooltip
dist/v-tooltip.esm.js
addClasses
function addClasses(el, classes) { var newClasses = convertToArray(classes); var classList; if (el.className instanceof SVGAnimatedString) { classList = convertToArray(el.className.baseVal); } else { classList = convertToArray(el.className); } newClasses.forEach(function (newClass) { if (class...
javascript
function addClasses(el, classes) { var newClasses = convertToArray(classes); var classList; if (el.className instanceof SVGAnimatedString) { classList = convertToArray(el.className.baseVal); } else { classList = convertToArray(el.className); } newClasses.forEach(function (newClass) { if (class...
[ "function", "addClasses", "(", "el", ",", "classes", ")", "{", "var", "newClasses", "=", "convertToArray", "(", "classes", ")", ";", "var", "classList", ";", "if", "(", "el", ".", "className", "instanceof", "SVGAnimatedString", ")", "{", "classList", "=", ...
Add classes to an element. This method checks to ensure that the classes don't already exist before adding them. It uses el.className rather than classList in order to be IE friendly. @param {object} el - The element to add the classes to. @param {classes} string - List of space separated classes to be added to the ele...
[ "Add", "classes", "to", "an", "element", ".", "This", "method", "checks", "to", "ensure", "that", "the", "classes", "don", "t", "already", "exist", "before", "adding", "them", ".", "It", "uses", "el", ".", "className", "rather", "than", "classList", "in", ...
d60513c64c266f0c1e926e2e583a5733819138bd
https://github.com/Akryum/v-tooltip/blob/d60513c64c266f0c1e926e2e583a5733819138bd/dist/v-tooltip.esm.js#L95-L116
train
Akryum/v-tooltip
dist/v-tooltip.esm.js
removeClasses
function removeClasses(el, classes) { var newClasses = convertToArray(classes); var classList; if (el.className instanceof SVGAnimatedString) { classList = convertToArray(el.className.baseVal); } else { classList = convertToArray(el.className); } newClasses.forEach(function (newClass) { var in...
javascript
function removeClasses(el, classes) { var newClasses = convertToArray(classes); var classList; if (el.className instanceof SVGAnimatedString) { classList = convertToArray(el.className.baseVal); } else { classList = convertToArray(el.className); } newClasses.forEach(function (newClass) { var in...
[ "function", "removeClasses", "(", "el", ",", "classes", ")", "{", "var", "newClasses", "=", "convertToArray", "(", "classes", ")", ";", "var", "classList", ";", "if", "(", "el", ".", "className", "instanceof", "SVGAnimatedString", ")", "{", "classList", "=",...
Remove classes from an element. It uses el.className rather than classList in order to be IE friendly. @export @param {any} el The element to remove the classes from. @param {any} classes List of space separated classes to be removed from the element.
[ "Remove", "classes", "from", "an", "element", ".", "It", "uses", "el", ".", "className", "rather", "than", "classList", "in", "order", "to", "be", "IE", "friendly", "." ]
d60513c64c266f0c1e926e2e583a5733819138bd
https://github.com/Akryum/v-tooltip/blob/d60513c64c266f0c1e926e2e583a5733819138bd/dist/v-tooltip.esm.js#L125-L148
train
Akryum/v-tooltip
dist/v-tooltip.esm.js
Tooltip
function Tooltip(_reference, _options) { var _this = this; _classCallCheck(this, Tooltip); _defineProperty(this, "_events", []); _defineProperty(this, "_setTooltipNodeEvent", function (evt, reference, delay, options) { var relatedreference = evt.relatedreference || evt.toElement || evt.relatedT...
javascript
function Tooltip(_reference, _options) { var _this = this; _classCallCheck(this, Tooltip); _defineProperty(this, "_events", []); _defineProperty(this, "_setTooltipNodeEvent", function (evt, reference, delay, options) { var relatedreference = evt.relatedreference || evt.toElement || evt.relatedT...
[ "function", "Tooltip", "(", "_reference", ",", "_options", ")", "{", "var", "_this", "=", "this", ";", "_classCallCheck", "(", "this", ",", "Tooltip", ")", ";", "_defineProperty", "(", "this", ",", "\"_events\"", ",", "[", "]", ")", ";", "_defineProperty",...
Create a new Tooltip.js instance @class Tooltip @param {HTMLElement} reference - The DOM node used as reference of the tooltip (it can be a jQuery element). @param {Object} options @param {String} options.placement=bottom Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -...
[ "Create", "a", "new", "Tooltip", ".", "js", "instance" ]
d60513c64c266f0c1e926e2e583a5733819138bd
https://github.com/Akryum/v-tooltip/blob/d60513c64c266f0c1e926e2e583a5733819138bd/dist/v-tooltip.esm.js#L212-L256
train
IonicaBizau/scrape-it
lib/index.js
scrapeIt
function scrapeIt (url, opts, cb) { cb = assured(cb) req(url, (err, $, res, body) => { if (err) { return cb(err) } try { let scrapedData = scrapeIt.scrapeHTML($, opts) cb(null, { data: scrapedData, $, response: res, ...
javascript
function scrapeIt (url, opts, cb) { cb = assured(cb) req(url, (err, $, res, body) => { if (err) { return cb(err) } try { let scrapedData = scrapeIt.scrapeHTML($, opts) cb(null, { data: scrapedData, $, response: res, ...
[ "function", "scrapeIt", "(", "url", ",", "opts", ",", "cb", ")", "{", "cb", "=", "assured", "(", "cb", ")", "req", "(", "url", ",", "(", "err", ",", "$", ",", "res", ",", "body", ")", "=>", "{", "if", "(", "err", ")", "{", "return", "cb", "...
scrapeIt A scraping module for humans. @name scrapeIt @function @param {String|Object} url The page url or request options. @param {Object} opts The options passed to `scrapeHTML` method. @param {Function} cb The callback function. @return {Promise} A promise object resolving with: - `data` (Object): The scraped data...
[ "scrapeIt", "A", "scraping", "module", "for", "humans", "." ]
596191dfdbd5613ba88a58c9ee5a39f061c5b395
https://github.com/IonicaBizau/scrape-it/blob/596191dfdbd5613ba88a58c9ee5a39f061c5b395/lib/index.js#L29-L47
train
instea/react-native-popup-menu
build/rnpm.js
measure
function measure(ref) { return new Promise(function (resolve) { ref.measure(function (x, y, width, height, pageX, pageY) { resolve({ x: pageX, y: pageY, width: width, height: height }); }); }); }
javascript
function measure(ref) { return new Promise(function (resolve) { ref.measure(function (x, y, width, height, pageX, pageY) { resolve({ x: pageX, y: pageY, width: width, height: height }); }); }); }
[ "function", "measure", "(", "ref", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ")", "{", "ref", ".", "measure", "(", "function", "(", "x", ",", "y", ",", "width", ",", "height", ",", "pageX", ",", "pageY", ")", "{", "reso...
Promisifies measure's callback function and returns layout object.
[ "Promisifies", "measure", "s", "callback", "function", "and", "returns", "layout", "object", "." ]
46197a3a72a2031c040b6c1c5971199bb53f938b
https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L178-L189
train
instea/react-native-popup-menu
build/rnpm.js
makeTouchable
function makeTouchable(TouchableComponent) { var Touchable = TouchableComponent || reactNative.Platform.select({ android: reactNative.TouchableNativeFeedback, ios: reactNative.TouchableHighlight, default: reactNative.TouchableHighlight }); var defaultTouchableProps = {}; if (Touchable...
javascript
function makeTouchable(TouchableComponent) { var Touchable = TouchableComponent || reactNative.Platform.select({ android: reactNative.TouchableNativeFeedback, ios: reactNative.TouchableHighlight, default: reactNative.TouchableHighlight }); var defaultTouchableProps = {}; if (Touchable...
[ "function", "makeTouchable", "(", "TouchableComponent", ")", "{", "var", "Touchable", "=", "TouchableComponent", "||", "reactNative", ".", "Platform", ".", "select", "(", "{", "android", ":", "reactNative", ".", "TouchableNativeFeedback", ",", "ios", ":", "reactNa...
Create touchable component based on passed parameter and platform. It also returns default props for specific touchable types.
[ "Create", "touchable", "component", "based", "on", "passed", "parameter", "and", "platform", ".", "It", "also", "returns", "default", "props", "for", "specific", "touchable", "types", "." ]
46197a3a72a2031c040b6c1c5971199bb53f938b
https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L205-L223
train
instea/react-native-popup-menu
build/rnpm.js
iterator2array
function iterator2array(it) { // workaround around https://github.com/instea/react-native-popup-menu/issues/41#issuecomment-340290127 var arr = []; for (var next = it.next(); !next.done; next = it.next()) { arr.push(next.value); } return arr; }
javascript
function iterator2array(it) { // workaround around https://github.com/instea/react-native-popup-menu/issues/41#issuecomment-340290127 var arr = []; for (var next = it.next(); !next.done; next = it.next()) { arr.push(next.value); } return arr; }
[ "function", "iterator2array", "(", "it", ")", "{", "// workaround around https://github.com/instea/react-native-popup-menu/issues/41#issuecomment-340290127", "var", "arr", "=", "[", "]", ";", "for", "(", "var", "next", "=", "it", ".", "next", "(", ")", ";", "!", "ne...
Converts iterator to array
[ "Converts", "iterator", "to", "array" ]
46197a3a72a2031c040b6c1c5971199bb53f938b
https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L228-L237
train
instea/react-native-popup-menu
build/rnpm.js
deprecatedComponent
function deprecatedComponent(message) { var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; return function deprecatedComponentHOC(Component) { var _temp; return _temp = /*#__PURE__*/ function (_React$Component) { _inherits(DeprecatedComponent, ...
javascript
function deprecatedComponent(message) { var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; return function deprecatedComponentHOC(Component) { var _temp; return _temp = /*#__PURE__*/ function (_React$Component) { _inherits(DeprecatedComponent, ...
[ "function", "deprecatedComponent", "(", "message", ")", "{", "var", "methods", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "[", "]", ";", "return", "function", "...
Higher order component to deprecate usage of component. message - deprecate warning message methods - array of method names to be delegated to deprecated component
[ "Higher", "order", "component", "to", "deprecate", "usage", "of", "component", ".", "message", "-", "deprecate", "warning", "message", "methods", "-", "array", "of", "method", "names", "to", "be", "delegated", "to", "deprecated", "component" ]
46197a3a72a2031c040b6c1c5971199bb53f938b
https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L244-L299
train
instea/react-native-popup-menu
build/rnpm.js
isAsyncMode
function isAsyncMode(object) { { if (!hasWarnedAboutDeprecatedIsAsyncMode) { hasWarnedAboutDeprecatedIsAsyncMode = true; lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMod...
javascript
function isAsyncMode(object) { { if (!hasWarnedAboutDeprecatedIsAsyncMode) { hasWarnedAboutDeprecatedIsAsyncMode = true; lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMod...
[ "function", "isAsyncMode", "(", "object", ")", "{", "{", "if", "(", "!", "hasWarnedAboutDeprecatedIsAsyncMode", ")", "{", "hasWarnedAboutDeprecatedIsAsyncMode", "=", "true", ";", "lowPriorityWarning$1", "(", "false", ",", "'The ReactIs.isAsyncMode() alias has been deprecate...
AsyncMode should be deprecated
[ "AsyncMode", "should", "be", "deprecated" ]
46197a3a72a2031c040b6c1c5971199bb53f938b
https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L450-L458
train
instea/react-native-popup-menu
build/rnpm.js
makeMenuRegistry
function makeMenuRegistry() { var menus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map(); /** * Subscribes menu instance. */ function subscribe(instance) { var name = instance.getName(); if (menus.get(name)) { console.warn("incorrect usage of po...
javascript
function makeMenuRegistry() { var menus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Map(); /** * Subscribes menu instance. */ function subscribe(instance) { var name = instance.getName(); if (menus.get(name)) { console.warn("incorrect usage of po...
[ "function", "makeMenuRegistry", "(", ")", "{", "var", "menus", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "new", "Map", "(", ")", ";", "/**\n * Subscribes men...
Registry to subscribe, unsubscribe and update data of menus. menu data: { instance: react instance triggerLayout: Object - layout of menu trigger if known optionsLayout: Object - layout of menu options if known optionsCustomStyles: Object - custom styles of options }
[ "Registry", "to", "subscribe", "unsubscribe", "and", "update", "data", "of", "menus", "." ]
46197a3a72a2031c040b6c1c5971199bb53f938b
https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L1415-L1502
train
instea/react-native-popup-menu
build/rnpm.js
subscribe
function subscribe(instance) { var name = instance.getName(); if (menus.get(name)) { console.warn("incorrect usage of popup menu - menu with name ".concat(name, " already exists")); } menus.set(name, { name: name, instance: instance }); }
javascript
function subscribe(instance) { var name = instance.getName(); if (menus.get(name)) { console.warn("incorrect usage of popup menu - menu with name ".concat(name, " already exists")); } menus.set(name, { name: name, instance: instance }); }
[ "function", "subscribe", "(", "instance", ")", "{", "var", "name", "=", "instance", ".", "getName", "(", ")", ";", "if", "(", "menus", ".", "get", "(", "name", ")", ")", "{", "console", ".", "warn", "(", "\"incorrect usage of popup menu - menu with name \"",...
Subscribes menu instance.
[ "Subscribes", "menu", "instance", "." ]
46197a3a72a2031c040b6c1c5971199bb53f938b
https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L1421-L1432
train
instea/react-native-popup-menu
build/rnpm.js
updateLayoutInfo
function updateLayoutInfo(name) { var layouts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!menus.has(name)) { return; } var menu = Object.assign({}, menus.get(name)); if (layouts.hasOwnProperty('triggerLayout')) { menu.triggerLayout = la...
javascript
function updateLayoutInfo(name) { var layouts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!menus.has(name)) { return; } var menu = Object.assign({}, menus.get(name)); if (layouts.hasOwnProperty('triggerLayout')) { menu.triggerLayout = la...
[ "function", "updateLayoutInfo", "(", "name", ")", "{", "var", "layouts", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "{", "}", ";", "if", "(", "!", "menus", ...
Updates layout infomration.
[ "Updates", "layout", "infomration", "." ]
46197a3a72a2031c040b6c1c5971199bb53f938b
https://github.com/instea/react-native-popup-menu/blob/46197a3a72a2031c040b6c1c5971199bb53f938b/build/rnpm.js#L1446-L1464
train
elastic/apm-agent-rum-js
packages/rum-core/src/common/utils.js
setTag
function setTag(key, value, obj) { if (!obj || !key) return var skey = removeInvalidChars(key) if (value) { value = String(value) } obj[skey] = value return obj }
javascript
function setTag(key, value, obj) { if (!obj || !key) return var skey = removeInvalidChars(key) if (value) { value = String(value) } obj[skey] = value return obj }
[ "function", "setTag", "(", "key", ",", "value", ",", "obj", ")", "{", "if", "(", "!", "obj", "||", "!", "key", ")", "return", "var", "skey", "=", "removeInvalidChars", "(", "key", ")", "if", "(", "value", ")", "{", "value", "=", "String", "(", "v...
Convert values of the tag to be string to be compatible with the apm server prior to <6.7 version TODO: Remove string conversion in the next major release since support for boolean and number in the APM server has landed in 6.7 https://github.com/elastic/apm-server/pull/1712/
[ "Convert", "values", "of", "the", "tag", "to", "be", "string", "to", "be", "compatible", "with", "the", "apm", "server", "prior", "to", "<6", ".", "7", "version" ]
b877fa9e8ee8255e2f5d91e2d5dae61ff489fcd4
https://github.com/elastic/apm-agent-rum-js/blob/b877fa9e8ee8255e2f5d91e2d5dae61ff489fcd4/packages/rum-core/src/common/utils.js#L145-L153
train
mauron85/react-native-background-geolocation
index.js
function (successFn, errorFn) { successFn = successFn || emptyFn; errorFn = errorFn || emptyFn; RNBackgroundGeolocation.getStationaryLocation(successFn, errorFn); }
javascript
function (successFn, errorFn) { successFn = successFn || emptyFn; errorFn = errorFn || emptyFn; RNBackgroundGeolocation.getStationaryLocation(successFn, errorFn); }
[ "function", "(", "successFn", ",", "errorFn", ")", "{", "successFn", "=", "successFn", "||", "emptyFn", ";", "errorFn", "=", "errorFn", "||", "emptyFn", ";", "RNBackgroundGeolocation", ".", "getStationaryLocation", "(", "successFn", ",", "errorFn", ")", ";", "...
Returns current stationaryLocation if available. null if not
[ "Returns", "current", "stationaryLocation", "if", "available", ".", "null", "if", "not" ]
6bdedbee827f698b91d81c2b8db91663e3260462
https://github.com/mauron85/react-native-background-geolocation/blob/6bdedbee827f698b91d81c2b8db91663e3260462/index.js#L120-L124
train
Shopify/theme-scripts
packages/theme-product/theme-product.js
_validateProductStructure
function _validateProductStructure(product) { if (typeof product !== 'object') { throw new TypeError(product + ' is not an object.'); } if (Object.keys(product).length === 0 && product.constructor === Object) { throw new Error(product + ' is empty.'); } }
javascript
function _validateProductStructure(product) { if (typeof product !== 'object') { throw new TypeError(product + ' is not an object.'); } if (Object.keys(product).length === 0 && product.constructor === Object) { throw new Error(product + ' is empty.'); } }
[ "function", "_validateProductStructure", "(", "product", ")", "{", "if", "(", "typeof", "product", "!==", "'object'", ")", "{", "throw", "new", "TypeError", "(", "product", "+", "' is not an object.'", ")", ";", "}", "if", "(", "Object", ".", "keys", "(", ...
Check if the product data is a valid JS object Error will be thrown if type is invalid @param {object} product Product JSON object
[ "Check", "if", "the", "product", "data", "is", "a", "valid", "JS", "object", "Error", "will", "be", "thrown", "if", "type", "is", "invalid" ]
b2fb8f43db5f2115786051f3941207b65794c3d5
https://github.com/Shopify/theme-scripts/blob/b2fb8f43db5f2115786051f3941207b65794c3d5/packages/theme-product/theme-product.js#L94-L102
train
Shopify/theme-scripts
packages/theme-addresses/theme-addresses.js
buildOptions
function buildOptions (provinceNodeElement, provinces) { var defaultValue = provinceNodeElement.getAttribute('data-default'); provinces.forEach(function (option) { var optionElement = document.createElement('option'); optionElement.value = option[0]; optionElement.textContent = option[1]; province...
javascript
function buildOptions (provinceNodeElement, provinces) { var defaultValue = provinceNodeElement.getAttribute('data-default'); provinces.forEach(function (option) { var optionElement = document.createElement('option'); optionElement.value = option[0]; optionElement.textContent = option[1]; province...
[ "function", "buildOptions", "(", "provinceNodeElement", ",", "provinces", ")", "{", "var", "defaultValue", "=", "provinceNodeElement", ".", "getAttribute", "(", "'data-default'", ")", ";", "provinces", ".", "forEach", "(", "function", "(", "option", ")", "{", "v...
Builds the options for province selector
[ "Builds", "the", "options", "for", "province", "selector" ]
b2fb8f43db5f2115786051f3941207b65794c3d5
https://github.com/Shopify/theme-scripts/blob/b2fb8f43db5f2115786051f3941207b65794c3d5/packages/theme-addresses/theme-addresses.js#L78-L92
train
Shopify/theme-scripts
packages/theme-addresses/theme-addresses.js
buildProvince
function buildProvince (countryNodeElement, provinceNodeElement, selectedValue) { var selectedOption = getOption(countryNodeElement, selectedValue); var provinces = JSON.parse(selectedOption.getAttribute('data-provinces')); provinceNodeElement.options.length = 0; if (provinces.length) { buildOptions(provi...
javascript
function buildProvince (countryNodeElement, provinceNodeElement, selectedValue) { var selectedOption = getOption(countryNodeElement, selectedValue); var provinces = JSON.parse(selectedOption.getAttribute('data-provinces')); provinceNodeElement.options.length = 0; if (provinces.length) { buildOptions(provi...
[ "function", "buildProvince", "(", "countryNodeElement", ",", "provinceNodeElement", ",", "selectedValue", ")", "{", "var", "selectedOption", "=", "getOption", "(", "countryNodeElement", ",", "selectedValue", ")", ";", "var", "provinces", "=", "JSON", ".", "parse", ...
Builds the province selector
[ "Builds", "the", "province", "selector" ]
b2fb8f43db5f2115786051f3941207b65794c3d5
https://github.com/Shopify/theme-scripts/blob/b2fb8f43db5f2115786051f3941207b65794c3d5/packages/theme-addresses/theme-addresses.js#L97-L108
train
jenkinsci/blueocean-plugin
blueocean-dashboard/src/main/js/creation/github/api/GithubApiUtils.js
appendApiUrlParam
function appendApiUrlParam(fullUrl, apiUrl) { let appendedUrl = fullUrl; if (typeof apiUrl === 'string') { if (fullUrl.indexOf('?') === -1) { appendedUrl += '?'; } else { appendedUrl += '&'; } appendedUrl += 'apiUrl='; // trim trailing slash from...
javascript
function appendApiUrlParam(fullUrl, apiUrl) { let appendedUrl = fullUrl; if (typeof apiUrl === 'string') { if (fullUrl.indexOf('?') === -1) { appendedUrl += '?'; } else { appendedUrl += '&'; } appendedUrl += 'apiUrl='; // trim trailing slash from...
[ "function", "appendApiUrlParam", "(", "fullUrl", ",", "apiUrl", ")", "{", "let", "appendedUrl", "=", "fullUrl", ";", "if", "(", "typeof", "apiUrl", "===", "'string'", ")", "{", "if", "(", "fullUrl", ".", "indexOf", "(", "'?'", ")", "===", "-", "1", ")"...
Append the GitHub "apiUrl" param onto the URL if necessary. @param fullUrl @param apiUrl @returns {String}
[ "Append", "the", "GitHub", "apiUrl", "param", "onto", "the", "URL", "if", "necessary", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-dashboard/src/main/js/creation/github/api/GithubApiUtils.js#L7-L23
train
jenkinsci/blueocean-plugin
blueocean-dashboard/src/main/js/creation/github/api/GithubApiUtils.js
extractProtocolHost
function extractProtocolHost(url) { const urlNoQuery = url.split('?')[0]; const [protocol, hostAndPath] = urlNoQuery.split('//'); const host = hostAndPath.split('/')[0]; return `${protocol}//${host}`; }
javascript
function extractProtocolHost(url) { const urlNoQuery = url.split('?')[0]; const [protocol, hostAndPath] = urlNoQuery.split('//'); const host = hostAndPath.split('/')[0]; return `${protocol}//${host}`; }
[ "function", "extractProtocolHost", "(", "url", ")", "{", "const", "urlNoQuery", "=", "url", ".", "split", "(", "'?'", ")", "[", "0", "]", ";", "const", "[", "protocol", ",", "hostAndPath", "]", "=", "urlNoQuery", ".", "split", "(", "'//'", ")", ";", ...
Extract the protocol and host from a URL. Will not include the trailing slash. @param url @returns {string}
[ "Extract", "the", "protocol", "and", "host", "from", "a", "URL", ".", "Will", "not", "include", "the", "trailing", "slash", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-dashboard/src/main/js/creation/github/api/GithubApiUtils.js#L32-L37
train
jenkinsci/blueocean-plugin
blueocean-core-js/src/js/LoadingIndicator.js
setLoaderClass
function setLoaderClass(c, t) { timeouts.push( setTimeout(() => { loadbar.classList.add(c); }, t) ); }
javascript
function setLoaderClass(c, t) { timeouts.push( setTimeout(() => { loadbar.classList.add(c); }, t) ); }
[ "function", "setLoaderClass", "(", "c", ",", "t", ")", "{", "timeouts", ".", "push", "(", "setTimeout", "(", "(", ")", "=>", "{", "loadbar", ".", "classList", ".", "add", "(", "c", ")", ";", "}", ",", "t", ")", ")", ";", "}" ]
Add a timeout to transition the loading animation differently
[ "Add", "a", "timeout", "to", "transition", "the", "loading", "animation", "differently" ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-core-js/src/js/LoadingIndicator.js#L26-L32
train
jenkinsci/blueocean-plugin
js-extensions/@jenkins-cd/subs/extensions-bundle.js
findExtensionsYAMLFile
function findExtensionsYAMLFile() { for (var i = 0; i < paths.srcPaths.length; i++) { var srcPath = path.resolve(cwd, paths.srcPaths[i]); var extFile = path.resolve(srcPath, 'jenkins-js-extension.yaml'); if (fs.existsSync(extFile)) { return extFile; } } return un...
javascript
function findExtensionsYAMLFile() { for (var i = 0; i < paths.srcPaths.length; i++) { var srcPath = path.resolve(cwd, paths.srcPaths[i]); var extFile = path.resolve(srcPath, 'jenkins-js-extension.yaml'); if (fs.existsSync(extFile)) { return extFile; } } return un...
[ "function", "findExtensionsYAMLFile", "(", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "paths", ".", "srcPaths", ".", "length", ";", "i", "++", ")", "{", "var", "srcPath", "=", "path", ".", "resolve", "(", "cwd", ",", "paths", ".", ...
Find the jenkins-js-extension.yaml file in the src paths.
[ "Find", "the", "jenkins", "-", "js", "-", "extension", ".", "yaml", "file", "in", "the", "src", "paths", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/js-extensions/@jenkins-cd/subs/extensions-bundle.js#L90-L100
train
jenkinsci/blueocean-plugin
bin/pretty.js
loadSource
function loadSource(sourcePath) { return new Promise((fulfil, reject) => { fs.readFile(sourcePath, 'utf8', (err, data) => { if (err) { reject(err); } else { fulfil(data); } }); }); }
javascript
function loadSource(sourcePath) { return new Promise((fulfil, reject) => { fs.readFile(sourcePath, 'utf8', (err, data) => { if (err) { reject(err); } else { fulfil(data); } }); }); }
[ "function", "loadSource", "(", "sourcePath", ")", "{", "return", "new", "Promise", "(", "(", "fulfil", ",", "reject", ")", "=>", "{", "fs", ".", "readFile", "(", "sourcePath", ",", "'utf8'", ",", "(", "err", ",", "data", ")", "=>", "{", "if", "(", ...
Load w promise
[ "Load", "w", "promise" ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L87-L97
train
jenkinsci/blueocean-plugin
bin/pretty.js
saveSource
function saveSource(sourcePath, data) { return new Promise((fulfil, reject) => { fs.writeFile(sourcePath, data, 'utf8', err => { if (err) { reject(err); } else { fulfil(true); } }); }); }
javascript
function saveSource(sourcePath, data) { return new Promise((fulfil, reject) => { fs.writeFile(sourcePath, data, 'utf8', err => { if (err) { reject(err); } else { fulfil(true); } }); }); }
[ "function", "saveSource", "(", "sourcePath", ",", "data", ")", "{", "return", "new", "Promise", "(", "(", "fulfil", ",", "reject", ")", "=>", "{", "fs", ".", "writeFile", "(", "sourcePath", ",", "data", ",", "'utf8'", ",", "err", "=>", "{", "if", "("...
Save w promise
[ "Save", "w", "promise" ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L100-L110
train
jenkinsci/blueocean-plugin
bin/pretty.js
getSourceFilesFromGlob
function getSourceFilesFromGlob(globPattern, ignoreGlobs) { return new Promise((fulfil, reject) => { glob(globPattern, { ignore: ignoreGlobs }, (err, files) => { if (err) { reject(err); } else { fulfil(files); } }); }); }
javascript
function getSourceFilesFromGlob(globPattern, ignoreGlobs) { return new Promise((fulfil, reject) => { glob(globPattern, { ignore: ignoreGlobs }, (err, files) => { if (err) { reject(err); } else { fulfil(files); } }); }); }
[ "function", "getSourceFilesFromGlob", "(", "globPattern", ",", "ignoreGlobs", ")", "{", "return", "new", "Promise", "(", "(", "fulfil", ",", "reject", ")", "=>", "{", "glob", "(", "globPattern", ",", "{", "ignore", ":", "ignoreGlobs", "}", ",", "(", "err",...
Calls out to glob, but returns a promise
[ "Calls", "out", "to", "glob", "but", "returns", "a", "promise" ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L113-L123
train
jenkinsci/blueocean-plugin
bin/pretty.js
filterFiles
function filterFiles(files, validExtensions) { const accepted = []; for (const fileName of files) { if (accepted.indexOf(fileName) === -1 && fileMatchesExtension(fileName, validExtensions)) { accepted.push(fileName); } } return accepted; }
javascript
function filterFiles(files, validExtensions) { const accepted = []; for (const fileName of files) { if (accepted.indexOf(fileName) === -1 && fileMatchesExtension(fileName, validExtensions)) { accepted.push(fileName); } } return accepted; }
[ "function", "filterFiles", "(", "files", ",", "validExtensions", ")", "{", "const", "accepted", "=", "[", "]", ";", "for", "(", "const", "fileName", "of", "files", ")", "{", "if", "(", "accepted", ".", "indexOf", "(", "fileName", ")", "===", "-", "1", ...
Make sure we only use valid extensions, and each fileName appears only once
[ "Make", "sure", "we", "only", "use", "valid", "extensions", "and", "each", "fileName", "appears", "only", "once" ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L126-L136
train
jenkinsci/blueocean-plugin
bin/pretty.js
splitFilesIntoBatches
function splitFilesIntoBatches(files, config) { // We need to specifiy a different parser for TS files const configTS = Object.assign({}, config); configTS.parser = 'typescript'; const batches = []; batches.push({ files: files.filter(fileName => fileMatchesExtension(fileName, EXTENSIONS.js...
javascript
function splitFilesIntoBatches(files, config) { // We need to specifiy a different parser for TS files const configTS = Object.assign({}, config); configTS.parser = 'typescript'; const batches = []; batches.push({ files: files.filter(fileName => fileMatchesExtension(fileName, EXTENSIONS.js...
[ "function", "splitFilesIntoBatches", "(", "files", ",", "config", ")", "{", "// We need to specifiy a different parser for TS files", "const", "configTS", "=", "Object", ".", "assign", "(", "{", "}", ",", "config", ")", ";", "configTS", ".", "parser", "=", "'types...
Takes a list of files and initial config, and splits into two batches, each consisting of a subset of files and the specific config for that batch.
[ "Takes", "a", "list", "of", "files", "and", "initial", "config", "and", "splits", "into", "two", "batches", "each", "consisting", "of", "a", "subset", "of", "files", "and", "the", "specific", "config", "for", "that", "batch", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L157-L175
train
jenkinsci/blueocean-plugin
bin/pretty.js
prettifyBatches
function prettifyBatches(batches) { return Promise.all(batches.map(({ files, config }) => prettifyFiles(files, config))); }
javascript
function prettifyBatches(batches) { return Promise.all(batches.map(({ files, config }) => prettifyFiles(files, config))); }
[ "function", "prettifyBatches", "(", "batches", ")", "{", "return", "Promise", ".", "all", "(", "batches", ".", "map", "(", "(", "{", "files", ",", "config", "}", ")", "=>", "prettifyFiles", "(", "files", ",", "config", ")", ")", ")", ";", "}" ]
Runs prettifyFiles for each batch.
[ "Runs", "prettifyFiles", "for", "each", "batch", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L219-L221
train
jenkinsci/blueocean-plugin
bin/pretty.js
mergeBatchResults
function mergeBatchResults(batches) { let files = []; let unformattedFiles = []; let formattedFiles = []; let errors = []; batches.forEach(batch => { files.push(...batch.files); unformattedFiles.push(...batch.unformattedFiles); formattedFiles.push(...batch.formattedFiles); ...
javascript
function mergeBatchResults(batches) { let files = []; let unformattedFiles = []; let formattedFiles = []; let errors = []; batches.forEach(batch => { files.push(...batch.files); unformattedFiles.push(...batch.unformattedFiles); formattedFiles.push(...batch.formattedFiles); ...
[ "function", "mergeBatchResults", "(", "batches", ")", "{", "let", "files", "=", "[", "]", ";", "let", "unformattedFiles", "=", "[", "]", ";", "let", "formattedFiles", "=", "[", "]", ";", "let", "errors", "=", "[", "]", ";", "batches", ".", "forEach", ...
Merge the results from each batch into a single result of the same format
[ "Merge", "the", "results", "from", "each", "batch", "into", "a", "single", "result", "of", "the", "same", "format" ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L226-L240
train
jenkinsci/blueocean-plugin
bin/pretty.js
showResults
function showResults(files, formattedFiles, unformattedFiles, errors) { const formattedCount = formattedFiles.length; const unformattedCount = unformattedFiles.length; const errorCount = errors.length; const filesCount = files.length; const okCount = filesCount - formattedCount - unformattedCount - ...
javascript
function showResults(files, formattedFiles, unformattedFiles, errors) { const formattedCount = formattedFiles.length; const unformattedCount = unformattedFiles.length; const errorCount = errors.length; const filesCount = files.length; const okCount = filesCount - formattedCount - unformattedCount - ...
[ "function", "showResults", "(", "files", ",", "formattedFiles", ",", "unformattedFiles", ",", "errors", ")", "{", "const", "formattedCount", "=", "formattedFiles", ".", "length", ";", "const", "unformattedCount", "=", "unformattedFiles", ".", "length", ";", "const...
Display results to user
[ "Display", "results", "to", "user" ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/bin/pretty.js#L243-L282
train
jenkinsci/blueocean-plugin
blueocean-dashboard/src/main/js/util/PromiseDelayUtils.js
delayReject
function delayReject(delay = 1000) { const begin = time(); const promise = new Promise((resolve, reject) => { setTimeout(() => { if (promise.payload) { reject(promise.payload); } }, delay); }); return function proceed(error) { // if we ha...
javascript
function delayReject(delay = 1000) { const begin = time(); const promise = new Promise((resolve, reject) => { setTimeout(() => { if (promise.payload) { reject(promise.payload); } }, delay); }); return function proceed(error) { // if we ha...
[ "function", "delayReject", "(", "delay", "=", "1000", ")", "{", "const", "begin", "=", "time", "(", ")", ";", "const", "promise", "=", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "setTimeout", "(", "(", ")", "=>", "{", "if...
Returns a function that should be chained to a promise to reject it after the delay. @param {number} [delay] millis to delay @returns {function} rejection function to pass to 'then()'
[ "Returns", "a", "function", "that", "should", "be", "chained", "to", "a", "promise", "to", "reject", "it", "after", "the", "delay", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-dashboard/src/main/js/util/PromiseDelayUtils.js#L63-L84
train
jenkinsci/blueocean-plugin
js-extensions/src/ExtensionUtils.js
sortByOrdinal
function sortByOrdinal(extensions, done) { const sorted = extensions.sort((a, b) => { if (a.ordinal || b.ordinal) { if (!a.ordinal) return 1; if (!b.ordinal) return -1; if (a.ordinal < b.ordinal) return -1; return 1; } return a.pluginId.localeC...
javascript
function sortByOrdinal(extensions, done) { const sorted = extensions.sort((a, b) => { if (a.ordinal || b.ordinal) { if (!a.ordinal) return 1; if (!b.ordinal) return -1; if (a.ordinal < b.ordinal) return -1; return 1; } return a.pluginId.localeC...
[ "function", "sortByOrdinal", "(", "extensions", ",", "done", ")", "{", "const", "sorted", "=", "extensions", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "{", "if", "(", "a", ".", "ordinal", "||", "b", ".", "ordinal", ")", "{", "if", "(", "!"...
Sort extensions by ordinal if defined, then fallback to pluginId. @param extensions @param [done]
[ "Sort", "extensions", "by", "ordinal", "if", "defined", "then", "fallback", "to", "pluginId", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/js-extensions/src/ExtensionUtils.js#L6-L22
train
jenkinsci/blueocean-plugin
blueocean-core-js/src/js/parameter/rest/ParameterApi.js
prepareOptions
function prepareOptions(body) { const fetchOptions = Object.assign({}, fetchOptionsCommon); if (body) { try { fetchOptions.body = JSON.stringify(body); } catch (e) { console.warn('The form body are not added. Could not extract data from the body element', body); }...
javascript
function prepareOptions(body) { const fetchOptions = Object.assign({}, fetchOptionsCommon); if (body) { try { fetchOptions.body = JSON.stringify(body); } catch (e) { console.warn('The form body are not added. Could not extract data from the body element', body); }...
[ "function", "prepareOptions", "(", "body", ")", "{", "const", "fetchOptions", "=", "Object", ".", "assign", "(", "{", "}", ",", "fetchOptionsCommon", ")", ";", "if", "(", "body", ")", "{", "try", "{", "fetchOptions", ".", "body", "=", "JSON", ".", "str...
Helper method to clone and prepare the body if attached @param body - JSON object that we want to sent to the server @returns {*} fetchOptions
[ "Helper", "method", "to", "clone", "and", "prepare", "the", "body", "if", "attached" ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/blueocean-core-js/src/js/parameter/rest/ParameterApi.js#L18-L28
train
jenkinsci/blueocean-plugin
jenkins-design-language/bin/import-material-icons.js
validateSourcePath
function validateSourcePath(sourcePath) { const materialPackageJSONPath = pathUtils.resolve(sourcePath, 'package.json'); return fs.readFileAsync(materialPackageJSONPath, { encoding: 'UTF8' }) .then(materialPackageJSONString => { const package = JSON.parse(materialPackageJSONString); ...
javascript
function validateSourcePath(sourcePath) { const materialPackageJSONPath = pathUtils.resolve(sourcePath, 'package.json'); return fs.readFileAsync(materialPackageJSONPath, { encoding: 'UTF8' }) .then(materialPackageJSONString => { const package = JSON.parse(materialPackageJSONString); ...
[ "function", "validateSourcePath", "(", "sourcePath", ")", "{", "const", "materialPackageJSONPath", "=", "pathUtils", ".", "resolve", "(", "sourcePath", ",", "'package.json'", ")", ";", "return", "fs", ".", "readFileAsync", "(", "materialPackageJSONPath", ",", "{", ...
Make sure the source path is correct in that it exists and appears to point to the root of the repo we want.
[ "Make", "sure", "the", "source", "path", "is", "correct", "in", "that", "it", "exists", "and", "appears", "to", "point", "to", "the", "root", "of", "the", "repo", "we", "want", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/jenkins-design-language/bin/import-material-icons.js#L119-L130
train
jenkinsci/blueocean-plugin
jenkins-design-language/bin/import-material-icons.js
findSourceFiles
function findSourceFiles(sourceIconsRoot) { let visitedDirectories = []; let allSourceFiles = []; function recurseDir(dir, depth) { // Don't get in any loops if (visitedDirectories.indexOf(dir) !== -1) { return; } if (depth > 3) { throw new Error('fi...
javascript
function findSourceFiles(sourceIconsRoot) { let visitedDirectories = []; let allSourceFiles = []; function recurseDir(dir, depth) { // Don't get in any loops if (visitedDirectories.indexOf(dir) !== -1) { return; } if (depth > 3) { throw new Error('fi...
[ "function", "findSourceFiles", "(", "sourceIconsRoot", ")", "{", "let", "visitedDirectories", "=", "[", "]", ";", "let", "allSourceFiles", "=", "[", "]", ";", "function", "recurseDir", "(", "dir", ",", "depth", ")", "{", "// Don't get in any loops", "if", "(",...
Traverse the tree starting at sourcePath, and find all the .js files. Only goes 3 levels deep, will throw if it gives up due to tree depth. Kind of ugly, but better than pulling in some npm module with 45 transitive dependencies. Please let me know if there's a nicer way to do this! - JM
[ "Traverse", "the", "tree", "starting", "at", "sourcePath", "and", "find", "all", "the", ".", "js", "files", "." ]
6e87cc0e76449669a942d66a9391cd7a46a943e0
https://github.com/jenkinsci/blueocean-plugin/blob/6e87cc0e76449669a942d66a9391cd7a46a943e0/jenkins-design-language/bin/import-material-icons.js#L140-L196
train
toji/gl-matrix
spec/helpers/spec-helper.js
function(a, epsilon) { if(epsilon == undefined) epsilon = EPSILON; let allSignsFlipped = false; if (e.length != a.length) expected(e, "to have the same length as", a); for (let i = 0; i < e.length; i++) { if (isNaN(e...
javascript
function(a, epsilon) { if(epsilon == undefined) epsilon = EPSILON; let allSignsFlipped = false; if (e.length != a.length) expected(e, "to have the same length as", a); for (let i = 0; i < e.length; i++) { if (isNaN(e...
[ "function", "(", "a", ",", "epsilon", ")", "{", "if", "(", "epsilon", "==", "undefined", ")", "epsilon", "=", "EPSILON", ";", "let", "allSignsFlipped", "=", "false", ";", "if", "(", "e", ".", "length", "!=", "a", ".", "length", ")", "expected", "(", ...
Dual quaternions are very special & unique snowflakes
[ "Dual", "quaternions", "are", "very", "special", "&", "unique", "snowflakes" ]
9ea87effc0ca32feb8511a01685ee596c6160fcc
https://github.com/toji/gl-matrix/blob/9ea87effc0ca32feb8511a01685ee596c6160fcc/spec/helpers/spec-helper.js#L86-L106
train
optimizely/nuclear-js
examples/rest-api/src/modules/rest-api/create-api-actions.js
onDeleteSuccess
function onDeleteSuccess(model, params, result) { Flux.dispatch(actionTypes.API_DELETE_SUCCESS, { model: model, params: params, result: result, }) return result }
javascript
function onDeleteSuccess(model, params, result) { Flux.dispatch(actionTypes.API_DELETE_SUCCESS, { model: model, params: params, result: result, }) return result }
[ "function", "onDeleteSuccess", "(", "model", ",", "params", ",", "result", ")", "{", "Flux", ".", "dispatch", "(", "actionTypes", ".", "API_DELETE_SUCCESS", ",", "{", "model", ":", "model", ",", "params", ":", "params", ",", "result", ":", "result", ",", ...
Handler for API delete success, dispatches flux action to remove the instance from the stores @param {Model} model @param {*} params used to call the `model.delete(params)` @param {Object} result @return {Object}
[ "Handler", "for", "API", "delete", "success", "dispatches", "flux", "action", "to", "remove", "the", "instance", "from", "the", "stores" ]
102fe399c8730375dece7711c66f1d46c860f5ae
https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/examples/rest-api/src/modules/rest-api/create-api-actions.js#L140-L147
train
optimizely/nuclear-js
examples/rest-api/src/modules/rest-api/create-api-actions.js
onDeleteFail
function onDeleteFail(model, params, reason) { Flux.dispatch(actionTypes.API_DELETE_FAIL, { model: model, params: params, reason: reason, }) return Promise.reject(reason) }
javascript
function onDeleteFail(model, params, reason) { Flux.dispatch(actionTypes.API_DELETE_FAIL, { model: model, params: params, reason: reason, }) return Promise.reject(reason) }
[ "function", "onDeleteFail", "(", "model", ",", "params", ",", "reason", ")", "{", "Flux", ".", "dispatch", "(", "actionTypes", ".", "API_DELETE_FAIL", ",", "{", "model", ":", "model", ",", "params", ":", "params", ",", "reason", ":", "reason", ",", "}", ...
Handler for API delete fail @param {Model} model @param {*} params used to call the `model.delete(params)` @param {Object} result @return {Object}
[ "Handler", "for", "API", "delete", "fail" ]
102fe399c8730375dece7711c66f1d46c860f5ae
https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/examples/rest-api/src/modules/rest-api/create-api-actions.js#L156-L163
train
optimizely/nuclear-js
src/getter.js
getFlattenedDeps
function getFlattenedDeps(getter, existing) { if (!existing) { existing = Immutable.Set() } const toAdd = Immutable.Set().withMutations(set => { if (!isGetter(getter)) { throw new Error('getFlattenedDeps must be passed a Getter') } getDeps(getter).forEach(dep => { if (isKeyPath(dep))...
javascript
function getFlattenedDeps(getter, existing) { if (!existing) { existing = Immutable.Set() } const toAdd = Immutable.Set().withMutations(set => { if (!isGetter(getter)) { throw new Error('getFlattenedDeps must be passed a Getter') } getDeps(getter).forEach(dep => { if (isKeyPath(dep))...
[ "function", "getFlattenedDeps", "(", "getter", ",", "existing", ")", "{", "if", "(", "!", "existing", ")", "{", "existing", "=", "Immutable", ".", "Set", "(", ")", "}", "const", "toAdd", "=", "Immutable", ".", "Set", "(", ")", ".", "withMutations", "("...
Returns an array of deps from a getter and all its deps @param {Getter} getter @param {Immutable.Set} existing @return {Immutable.Set}
[ "Returns", "an", "array", "of", "deps", "from", "a", "getter", "and", "all", "its", "deps" ]
102fe399c8730375dece7711c66f1d46c860f5ae
https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/src/getter.js#L45-L67
train
optimizely/nuclear-js
src/reactor/fns.js
createCacheEntry
function createCacheEntry(reactorState, getter) { // evaluate dependencies const args = getDeps(getter).map(dep => evaluate(reactorState, dep).result) const value = getComputeFn(getter).apply(null, args) const storeDeps = getStoreDeps(getter) const storeStates = toImmutable({}).withMutations(map => { sto...
javascript
function createCacheEntry(reactorState, getter) { // evaluate dependencies const args = getDeps(getter).map(dep => evaluate(reactorState, dep).result) const value = getComputeFn(getter).apply(null, args) const storeDeps = getStoreDeps(getter) const storeStates = toImmutable({}).withMutations(map => { sto...
[ "function", "createCacheEntry", "(", "reactorState", ",", "getter", ")", "{", "// evaluate dependencies", "const", "args", "=", "getDeps", "(", "getter", ")", ".", "map", "(", "dep", "=>", "evaluate", "(", "reactorState", ",", "dep", ")", ".", "result", ")",...
Evaluates getter for given reactorState and returns CacheEntry @param {ReactorState} reactorState @param {Getter} getter @return {CacheEntry}
[ "Evaluates", "getter", "for", "given", "reactorState", "and", "returns", "CacheEntry" ]
102fe399c8730375dece7711c66f1d46c860f5ae
https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/src/reactor/fns.js#L408-L426
train
optimizely/nuclear-js
examples/flux-chat/js/modules/chat/stores/thread-store.js
setMessagesRead
function setMessagesRead(state, { threadID }) { return state.updateIn([threadID, 'messages'], messages => { return messages.map(msg => msg.set('isRead', true)) }) }
javascript
function setMessagesRead(state, { threadID }) { return state.updateIn([threadID, 'messages'], messages => { return messages.map(msg => msg.set('isRead', true)) }) }
[ "function", "setMessagesRead", "(", "state", ",", "{", "threadID", "}", ")", "{", "return", "state", ".", "updateIn", "(", "[", "threadID", ",", "'messages'", "]", ",", "messages", "=>", "{", "return", "messages", ".", "map", "(", "msg", "=>", "msg", "...
Mark all messages for a thread as "read" @param {Immutable.Map} @param {Object} payload @param {GUID} payload.threadID
[ "Mark", "all", "messages", "for", "a", "thread", "as", "read" ]
102fe399c8730375dece7711c66f1d46c860f5ae
https://github.com/optimizely/nuclear-js/blob/102fe399c8730375dece7711c66f1d46c860f5ae/examples/flux-chat/js/modules/chat/stores/thread-store.js#L66-L70
train
mipengine/mip2
packages/mip/src/performance.js
removeFsElement
function removeFsElement (element) { let index = fsElements.indexOf(element) if (index !== -1) { fsElements.splice(index, 1) } }
javascript
function removeFsElement (element) { let index = fsElements.indexOf(element) if (index !== -1) { fsElements.splice(index, 1) } }
[ "function", "removeFsElement", "(", "element", ")", "{", "let", "index", "=", "fsElements", ".", "indexOf", "(", "element", ")", "if", "(", "index", "!==", "-", "1", ")", "{", "fsElements", ".", "splice", "(", "index", ",", "1", ")", "}", "}" ]
Remove element from fsElements. @param {HTMLElement} element html element
[ "Remove", "element", "from", "fsElements", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/performance.js#L66-L71
train
mipengine/mip2
packages/mip/src/performance.js
getTiming
function getTiming () { let nativeTiming let performance = window.performance if (performance && performance.timing) { nativeTiming = performance.timing.toJSON ? performance.timing.toJSON() : util.fn.extend({}, performance.timing) } else { nativeTiming = {} } return util.fn.extend(native...
javascript
function getTiming () { let nativeTiming let performance = window.performance if (performance && performance.timing) { nativeTiming = performance.timing.toJSON ? performance.timing.toJSON() : util.fn.extend({}, performance.timing) } else { nativeTiming = {} } return util.fn.extend(native...
[ "function", "getTiming", "(", ")", "{", "let", "nativeTiming", "let", "performance", "=", "window", ".", "performance", "if", "(", "performance", "&&", "performance", ".", "timing", ")", "{", "nativeTiming", "=", "performance", ".", "timing", ".", "toJSON", ...
Get the timings. @return {Object}
[ "Get", "the", "timings", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/performance.js#L78-L89
train
mipengine/mip2
packages/mip/src/performance.js
recordTiming
function recordTiming (name, timing) { recorder[name] = parseInt(timing, 10) || Date.now() performanceEvent.trigger('update', getTiming()) }
javascript
function recordTiming (name, timing) { recorder[name] = parseInt(timing, 10) || Date.now() performanceEvent.trigger('update', getTiming()) }
[ "function", "recordTiming", "(", "name", ",", "timing", ")", "{", "recorder", "[", "name", "]", "=", "parseInt", "(", "timing", ",", "10", ")", "||", "Date", ".", "now", "(", ")", "performanceEvent", ".", "trigger", "(", "'update'", ",", "getTiming", "...
Record timing by name. @param {string} name Name of the timing. @param {?number} timing timing
[ "Record", "timing", "by", "name", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/performance.js#L97-L100
train
mipengine/mip2
packages/mip/src/performance.js
lockFirstScreen
function lockFirstScreen () { // when is prerendering, iframe container display none, // all elements are not in viewport. if (prerender.isPrerendering) { return } let viewportRect = viewport.getRect() fsElements = fsElements.filter((element) => { if (prerender.isPrerendered) { return element....
javascript
function lockFirstScreen () { // when is prerendering, iframe container display none, // all elements are not in viewport. if (prerender.isPrerendering) { return } let viewportRect = viewport.getRect() fsElements = fsElements.filter((element) => { if (prerender.isPrerendered) { return element....
[ "function", "lockFirstScreen", "(", ")", "{", "// when is prerendering, iframe container display none,", "// all elements are not in viewport.", "if", "(", "prerender", ".", "isPrerendering", ")", "{", "return", "}", "let", "viewportRect", "=", "viewport", ".", "getRect", ...
Lock the fsElements. No longer add fsElements.
[ "Lock", "the", "fsElements", ".", "No", "longer", "add", "fsElements", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/performance.js#L115-L134
train