code
stringlengths 28
313k
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
74
| language
stringclasses 1
value | repo
stringlengths 5
60
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
sync(synced, position) {
if (isUnd(synced) || synced && isUnd(synced.pause)) return this;
synced.pause();
const duration = +(/** @type {globalThis.Animation} */(synced).effect ? /** @type {globalThis.Animation} */(synced).effect.getTiming().duration : /** @type {Tickable} */(synced).duration);
return this.add(synced, { currentTime: [0, duration], duration, ease: 'linear' }, position);
}
|
@overload
@param {Tickable} [synced]
@param {TimePosition} [position]
@return {this}
@overload
@param {globalThis.Animation} [synced]
@param {TimePosition} [position]
@return {this}
@overload
@param {WAAPIAnimation} [synced]
@param {TimePosition} [position]
@return {this}
@param {Tickable|WAAPIAnimation|globalThis.Animation} [synced]
@param {TimePosition} [position]
|
sync
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
set(targets, parameters, position) {
if (isUnd(parameters)) return this;
parameters.duration = minValue;
parameters.composition = compositionTypes.replace;
return this.add(targets, parameters, position);
}
|
@param {TargetsParam} targets
@param {AnimationParams} parameters
@param {TimePosition} [position]
@return {this}
|
set
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
call(callback, position) {
if (isUnd(callback) || callback && !isFnc(callback)) return this;
return this.add({ duration: 0, onComplete: () => callback(this) }, position);
}
|
@param {Callback<Timer>} callback
@param {TimePosition} [position]
@return {this}
|
call
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
label(labelName, position) {
if (isUnd(labelName) || labelName && !isStr(labelName)) return this;
this.labels[labelName] = parseTimelinePosition(this,/** @type TimePosition */(position));
return this;
}
|
@param {String} labelName
@param {TimePosition} [position]
@return {this}
|
label
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
remove(targets, propertyName) {
remove(targets, this, propertyName);
return this;
}
|
@param {TargetsParam} targets
@param {String} [propertyName]
@return {this}
|
remove
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
constructor(targets, parameters) {
if (globals.scope) globals.scope.revertibles.push(this);
/** @type {AnimationParams} */
const globalParams = {};
const properties = {};
this.targets = [];
this.animations = {};
if (isUnd(targets) || isUnd(parameters)) return;
for (let propName in parameters) {
const paramValue = parameters[propName];
if (isKey(propName)) {
properties[propName] = paramValue;
} else {
globalParams[propName] = paramValue;
}
}
for (let propName in properties) {
const propValue = properties[propName];
const isObjValue = isObj(propValue);
/** @type {TweenParamsOptions} */
let propParams = {};
let to = '+=0';
if (isObjValue) {
const unit = propValue.unit;
if (isStr(unit)) to += unit;
} else {
propParams.duration = propValue;
}
propParams[propName] = isObjValue ? mergeObjects({ to }, propValue) : to;
const animParams = mergeObjects(globalParams, propParams);
animParams.composition = compositionTypes.replace;
animParams.autoplay = false;
const animation = this.animations[propName] = new JSAnimation(targets, animParams, null, 0, false).init();
if (!this.targets.length) this.targets.push(...animation.targets);
/** @type {AnimatableProperty} */
this[propName] = (to, duration, ease) => {
const tween = /** @type {Tween} */(animation._head);
if (isUnd(to) && tween) {
const numbers = tween._numbers;
if (numbers && numbers.length) {
return numbers;
} else {
return tween._modifier(tween._number);
}
} else {
forEachChildren(animation, (/** @type {Tween} */tween) => {
if (isArr(to)) {
for (let i = 0, l = /** @type {Array} */(to).length; i < l; i++) {
if (!isUnd(tween._numbers[i])) {
tween._fromNumbers[i] = /** @type {Number} */(tween._modifier(tween._numbers[i]));
tween._toNumbers[i] = to[i];
}
}
} else {
tween._fromNumber = /** @type {Number} */(tween._modifier(tween._number));
tween._toNumber = /** @type {Number} */(to);
}
if (!isUnd(ease)) tween._ease = parseEasings(ease);
tween._currentTime = 0;
});
if (!isUnd(duration)) animation.stretch(duration);
animation.reset(1).resume();
return this;
}
};
}
}
|
@param {TargetsParam} targets
@param {AnimatableParams} parameters
|
constructor
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
normalizePoint(x, y) {
this.point.x = x;
this.point.y = y;
return this.point.matrixTransform(this.inversedMatrix);
}
|
@param {Number} x
@param {Number} y
@return {DOMPoint}
|
normalizePoint
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
constructor(target, parameters = {}) {
if (!target) return;
if (globals.scope) globals.scope.revertibles.push(this);
const paramX = parameters.x;
const paramY = parameters.y;
const trigger = parameters.trigger;
const modifier = parameters.modifier;
const ease = parameters.releaseEase;
const customEase = ease && parseEasings(ease);
const hasSpring = !isUnd(ease) && !isUnd(/** @type {Spring} */(ease).ease);
const xProp = /** @type {String} */(isObj(paramX) && !isUnd(/** @type {Object} */(paramX).mapTo) ? /** @type {Object} */(paramX).mapTo : 'translateX');
const yProp = /** @type {String} */(isObj(paramY) && !isUnd(/** @type {Object} */(paramY).mapTo) ? /** @type {Object} */(paramY).mapTo : 'translateY');
const container = parseDraggableFunctionParameter(parameters.container, this);
this.containerArray = isArr(container) ? container : null;
this.$container = /** @type {HTMLElement} */(container && !this.containerArray ? parseTargets(/** @type {DOMTarget} */(container))[0] : doc.body);
this.useWin = this.$container === doc.body;
/** @type {Window | HTMLElement} */
this.$scrollContainer = this.useWin ? win : this.$container;
this.$target = /** @type {HTMLElement} */(isObj(target) ? new DOMProxy(target) : parseTargets(target)[0]);
this.$trigger = /** @type {HTMLElement} */(parseTargets(trigger ? trigger : target)[0]);
this.fixed = getTargetValue(this.$target, 'position') === 'fixed';
// Refreshable parameters
this.isFinePointer = true;
/** @type {[Number, Number, Number, Number]} */
this.containerPadding = [0, 0, 0, 0];
/** @type {Number} */
this.containerFriction = 0;
/** @type {Number} */
this.releaseContainerFriction = 0;
/** @type {Number|Array<Number>} */
this.snapX = 0;
/** @type {Number|Array<Number>} */
this.snapY = 0;
/** @type {Number} */
this.scrollSpeed = 0;
/** @type {Number} */
this.scrollThreshold = 0;
/** @type {Number} */
this.dragSpeed = 0;
/** @type {Number} */
this.maxVelocity = 0;
/** @type {Number} */
this.minVelocity = 0;
/** @type {Number} */
this.velocityMultiplier = 0;
/** @type {Boolean|DraggableCursorParams} */
this.cursor = false;
/** @type {Spring} */
this.releaseXSpring = hasSpring ? /** @type {Spring} */(ease) : createSpring({
mass: setValue(parameters.releaseMass, 1),
stiffness: setValue(parameters.releaseStiffness, 80),
damping: setValue(parameters.releaseDamping, 20),
});
/** @type {Spring} */
this.releaseYSpring = hasSpring ? /** @type {Spring} */(ease) : createSpring({
mass: setValue(parameters.releaseMass, 1),
stiffness: setValue(parameters.releaseStiffness, 80),
damping: setValue(parameters.releaseDamping, 20),
});
/** @type {EasingFunction} */
this.releaseEase = customEase || eases.outQuint;
/** @type {Boolean} */
this.hasReleaseSpring = hasSpring;
/** @type {Callback<this>} */
this.onGrab = parameters.onGrab || noop;
/** @type {Callback<this>} */
this.onDrag = parameters.onDrag || noop;
/** @type {Callback<this>} */
this.onRelease = parameters.onRelease || noop;
/** @type {Callback<this>} */
this.onUpdate = parameters.onUpdate || noop;
/** @type {Callback<this>} */
this.onSettle = parameters.onSettle || noop;
/** @type {Callback<this>} */
this.onSnap = parameters.onSnap || noop;
/** @type {Callback<this>} */
this.onResize = parameters.onResize || noop;
/** @type {Callback<this>} */
this.onAfterResize = parameters.onAfterResize || noop;
/** @type {[Number, Number]} */
this.disabled = [0, 0];
/** @type {AnimatableParams} */
const animatableParams = {};
if (modifier) animatableParams.modifier = modifier;
if (isUnd(paramX) || paramX === true) {
animatableParams[xProp] = 0;
} else if (isObj(paramX)) {
const paramXObject = /** @type {DraggableAxisParam} */(paramX);
const animatableXParams = {};
if (paramXObject.modifier) animatableXParams.modifier = paramXObject.modifier;
if (paramXObject.composition) animatableXParams.composition = paramXObject.composition;
animatableParams[xProp] = animatableXParams;
} else if (paramX === false) {
animatableParams[xProp] = 0;
this.disabled[0] = 1;
}
if (isUnd(paramY) || paramY === true) {
animatableParams[yProp] = 0;
} else if (isObj(paramY)) {
const paramYObject = /** @type {DraggableAxisParam} */(paramY);
const animatableYParams = {};
if (paramYObject.modifier) animatableYParams.modifier = paramYObject.modifier;
if (paramYObject.composition) animatableYParams.composition = paramYObject.composition;
animatableParams[yProp] = animatableYParams;
} else if (paramY === false) {
animatableParams[yProp] = 0;
this.disabled[1] = 1;
}
/** @type {AnimatableObject} */
this.animate = /** @type {AnimatableObject} */(new Animatable(this.$target, animatableParams));
// Internal props
this.xProp = xProp;
this.yProp = yProp;
this.destX = 0;
this.destY = 0;
this.deltaX = 0;
this.deltaY = 0;
this.scroll = {x: 0, y: 0};
/** @type {[Number, Number, Number, Number]} */
this.coords = [this.x, this.y, 0, 0]; // x, y, temp x, temp y
/** @type {[Number, Number]} */
this.snapped = [0, 0]; // x, y
/** @type {[Number, Number, Number, Number, Number, Number, Number, Number]} */
this.pointer = [0, 0, 0, 0, 0, 0, 0, 0]; // x1, y1, x2, y2, temp x1, temp y1, temp x2, temp y2
/** @type {[Number, Number]} */
this.scrollView = [0, 0]; // w, h
/** @type {[Number, Number, Number, Number]} */
this.dragArea = [0, 0, 0, 0]; // x, y, w, h
/** @type {[Number, Number, Number, Number]} */
this.containerBounds = [-1e12, maxValue, maxValue, -1e12]; // t, r, b, l
/** @type {[Number, Number, Number, Number]} */
this.scrollBounds = [0, 0, 0, 0]; // t, r, b, l
/** @type {[Number, Number, Number, Number]} */
this.targetBounds = [0, 0, 0, 0]; // t, r, b, l
/** @type {[Number, Number]} */
this.window = [0, 0]; // w, h
/** @type {[Number, Number, Number]} */
this.velocityStack = [0, 0, 0];
/** @type {Number} */
this.velocityStackIndex = 0;
/** @type {Number} */
this.velocityTime = now();
/** @type {Number} */
this.velocity = 0;
/** @type {Number} */
this.angle = 0;
/** @type {JSAnimation} */
this.cursorStyles = null;
/** @type {JSAnimation} */
this.triggerStyles = null;
/** @type {JSAnimation} */
this.bodyStyles = null;
/** @type {JSAnimation} */
this.targetStyles = null;
/** @type {JSAnimation} */
this.touchActionStyles = null;
this.transforms = new Transforms(this.$target);
this.overshootCoords = { x: 0, y: 0 };
this.overshootXTicker = new Timer({ autoplay: false }, null, 0).init();
this.overshootYTicker = new Timer({ autoplay: false }, null, 0).init();
this.updateTicker = new Timer({ autoplay: false }, null, 0).init();
this.overshootXTicker.onUpdate = () => {
if (this.disabled[0]) return;
this.updated = true;
this.manual = true;
this.animate[this.xProp](this.overshootCoords.x, 0);
};
this.overshootXTicker.onComplete = () => {
if (this.disabled[0]) return;
this.manual = false;
this.animate[this.xProp](this.overshootCoords.x, 0);
};
this.overshootYTicker.onUpdate = () => {
if (this.disabled[1]) return;
this.updated = true;
this.manual = true;
this.animate[this.yProp](this.overshootCoords.y, 0);
};
this.overshootYTicker.onComplete = () => {
if (this.disabled[1]) return;
this.manual = false;
this.animate[this.yProp](this.overshootCoords.y, 0);
};
this.updateTicker.onUpdate = () => this.update();
this.contained = !isUnd(container);
this.manual = false;
this.grabbed = false;
this.dragged = false;
this.updated = false;
this.released = false;
this.canScroll = false;
this.enabled = false;
this.initialized = false;
this.activeProp = this.disabled[1] ? xProp : yProp;
this.animate.animations[this.activeProp].onRender = () => {
const hasUpdated = this.updated;
const hasMoved = this.grabbed && hasUpdated;
const hasReleased = !hasMoved && this.released;
const x = this.x;
const y = this.y;
const dx = x - this.coords[2];
const dy = y - this.coords[3];
this.deltaX = dx;
this.deltaY = dy;
this.coords[2] = x;
this.coords[3] = y;
if (hasUpdated) {
this.onUpdate(this);
}
if (!hasReleased) {
this.updated = false;
} else {
this.computeVelocity(dx, dy);
this.angle = atan2(dy, dx);
}
};
this.animate.animations[this.activeProp].onComplete = () => {
if ((!this.grabbed && this.released)) {
// Set eleased to false before calling onSettle to avoid recursion
this.released = false;
}
if (!this.manual) {
this.deltaX = 0;
this.deltaY = 0;
this.velocity = 0;
this.velocityStack[0] = 0;
this.velocityStack[1] = 0;
this.velocityStack[2] = 0;
this.velocityStackIndex = 0;
this.onSettle(this);
}
};
this.resizeTicker = new Timer({
autoplay: false,
duration: 150 * globals.timeScale,
onComplete: () => {
this.onResize(this);
this.refresh();
this.onAfterResize(this);
},
}).init();
this.parameters = parameters;
this.resizeObserver = new ResizeObserver(() => {
if (this.initialized) {
this.resizeTicker.restart();
} else {
this.initialized = true;
}
});
this.enable();
this.refresh();
this.resizeObserver.observe(this.$container);
if (!isObj(target)) this.resizeObserver.observe(this.$target);
}
|
@param {TargetsParam} target
@param {DraggableParams} [parameters]
|
constructor
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
computeVelocity(dx, dy) {
const prevTime = this.velocityTime;
const curTime = now();
const elapsed = curTime - prevTime;
if (elapsed < 17) return this.velocity;
this.velocityTime = curTime;
const velocityStack = this.velocityStack;
const vMul = this.velocityMultiplier;
const minV = this.minVelocity;
const maxV = this.maxVelocity;
const vi = this.velocityStackIndex;
velocityStack[vi] = round(clamp((sqrt(dx * dx + dy * dy) / elapsed) * vMul, minV, maxV), 5);
const velocity = max(velocityStack[0], velocityStack[1], velocityStack[2]);
this.velocity = velocity;
this.velocityStackIndex = (vi + 1) % 3;
return velocity;
}
|
@param {Number} dx
@param {Number} dy
@return {Number}
|
computeVelocity
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
setX(x, muteUpdateCallback = false) {
if (this.disabled[0]) return;
const v = round(x, 5);
this.overshootXTicker.pause();
this.manual = true;
this.updated = !muteUpdateCallback;
this.destX = v;
this.snapped[0] = snap(v, this.snapX);
this.animate[this.xProp](v, 0);
this.manual = false;
return this;
}
|
@param {Number} x
@param {Boolean} [muteUpdateCallback]
@return {this}
|
setX
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
setY(y, muteUpdateCallback = false) {
if (this.disabled[1]) return;
const v = round(y, 5);
this.overshootYTicker.pause();
this.manual = true;
this.updated = !muteUpdateCallback;
this.destY = v;
this.snapped[1] = snap(v, this.snapY);
this.animate[this.yProp](v, 0);
this.manual = false;
return this;
}
|
@param {Number} y
@param {Boolean} [muteUpdateCallback]
@return {this}
|
setY
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
isOutOfBounds(bounds, x, y) {
if (!this.contained) return 0;
const [ bt, br, bb, bl ] = bounds;
const [ dx, dy ] = this.disabled;
const obx = !dx && x < bl || !dx && x > br;
const oby = !dy && y < bt || !dy && y > bb;
return obx && !oby ? 1 : !obx && oby ? 2 : obx && oby ? 3 : 0;
}
|
Returns 0 if not OB, 1 if x is OB, 2 if y is OB, 3 if both x and y are OB
@param {Array} bounds
@param {Number} x
@param {Number} y
@return {Number}
|
isOutOfBounds
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
scrollInView(duration, gap = 0, ease = eases.inOutQuad) {
this.updateScrollCoords();
const x = this.destX;
const y = this.destY;
const scroll = this.scroll;
const scrollBounds = this.scrollBounds;
const canScroll = this.canScroll;
if (!this.containerArray && this.isOutOfBounds(scrollBounds, x, y)) {
const [ st, sr, sb, sl ] = scrollBounds;
const t = round(clamp(y - st, -1e12, 0), 0);
const r = round(clamp(x - sr, 0, maxValue), 0);
const b = round(clamp(y - sb, 0, maxValue), 0);
const l = round(clamp(x - sl, -1e12, 0), 0);
new JSAnimation(scroll, {
x: round(scroll.x + (l ? l - gap : r ? r + gap : 0), 0),
y: round(scroll.y + (t ? t - gap : b ? b + gap : 0), 0),
duration: isUnd(duration) ? 350 * globals.timeScale : duration,
ease,
onUpdate: () => {
this.canScroll = false;
this.$scrollContainer.scrollTo(scroll.x, scroll.y);
}
}).init().then(() => {
this.canScroll = canScroll;
});
}
return this;
}
|
@param {Number} [duration]
@param {Number} [gap]
@param {EasingParam} [ease]
@return {this}
|
scrollInView
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
animateInView(duration, gap = 0, ease = eases.inOutQuad) {
this.stop();
this.updateBoundingValues();
const x = this.x;
const y = this.y;
const [ cpt, cpr, cpb, cpl ] = this.containerPadding;
const bt = this.scroll.y - this.targetBounds[0] + cpt + gap;
const br = this.scroll.x - this.targetBounds[1] - cpr - gap;
const bb = this.scroll.y - this.targetBounds[2] - cpb - gap;
const bl = this.scroll.x - this.targetBounds[3] + cpl + gap;
const ob = this.isOutOfBounds([bt, br, bb, bl], x, y);
if (ob) {
const [ disabledX, disabledY ] = this.disabled;
const destX = clamp(snap(x, this.snapX), bl, br);
const destY = clamp(snap(y, this.snapY), bt, bb);
const dur = isUnd(duration) ? 350 * globals.timeScale : duration;
if (!disabledX && (ob === 1 || ob === 3)) this.animate[this.xProp](destX, dur, ease);
if (!disabledY && (ob === 2 || ob === 3)) this.animate[this.yProp](destY, dur, ease);
}
return this;
}
|
@param {Number} [duration]
@param {Number} [gap]
@param {EasingParam} [ease]
@return {this}
|
animateInView
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
execute(cb) {
let activeScope = globals.scope;
let activeRoot = globals.root;
let activeDefaults = globals.defaults;
globals.scope = this;
globals.root = this.root;
globals.defaults = this.defaults;
const mqs = this.mediaQueryLists;
for (let mq in mqs) this.matches[mq] = mqs[mq].matches;
const returned = cb(this);
globals.scope = activeScope;
globals.root = activeRoot;
globals.defaults = activeDefaults;
return returned;
}
|
@callback ScoppedCallback
@param {this} scope
@return {any}
@param {ScoppedCallback} cb
@return {this}
|
execute
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
add(a1, a2) {
if (isFnc(a1)) {
const constructor = /** @type {contructorCallback} */(a1);
this.constructors.push(constructor);
this.execute(() => {
const revertConstructor = constructor(this);
if (revertConstructor) {
this.revertConstructors.push(revertConstructor);
}
});
} else {
this.methods[/** @type {String} */(a1)] = (/** @type {any} */...args) => this.execute(() => a2(...args));
}
return this;
}
|
@callback contructorCallback
@param {this} self
@overload
@param {String} a1
@param {ScopeMethod} a2
@return {this}
@overload
@param {contructorCallback} a1
@return {this}
@param {String|contructorCallback} a1
@param {ScopeMethod} [a2]
|
add
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
convertValueToPx = ($el, v, size, under, over) => {
const clampMin = v === 'min';
const clampMax = v === 'max';
const value = v === 'top' || v === 'left' || v === 'start' || clampMin ? 0 :
v === 'bottom' || v === 'right' || v === 'end' || clampMax ? '100%' :
v === 'center' ? '50%' :
v;
const { n, u } = decomposeRawValue(value, decomposedOriginalValue);
let px = n;
if (u === '%') {
px = (n / 100) * size;
} else if (u) {
px = convertValueUnit($el, decomposedOriginalValue, 'px', true).n;
}
if (clampMax && under < 0) px += under;
if (clampMin && over > 0) px += over;
return px;
}
|
@param {HTMLElement} $el
@param {Number|string} v
@param {Number} size
@param {Number} [under]
@param {Number} [over]
@return {Number}
|
convertValueToPx
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
parseBoundValue = ($el, v, size, under, over) => {
/** @type {Number} */
let value;
if (isStr(v)) {
const matchedOperator = relativeValuesExecRgx.exec(/** @type {String} */(v));
if (matchedOperator) {
const splitter = matchedOperator[0];
const operator = splitter[0];
const splitted = /** @type {String} */(v).split(splitter);
const clampMin = splitted[0] === 'min';
const clampMax = splitted[0] === 'max';
const valueAPx = convertValueToPx($el, splitted[0], size, under, over);
const valueBPx = convertValueToPx($el, splitted[1], size, under, over);
if (clampMin) {
const min = getRelativeValue(convertValueToPx($el, 'min', size), valueBPx, operator);
value = min < valueAPx ? valueAPx : min;
} else if (clampMax) {
const max = getRelativeValue(convertValueToPx($el, 'max', size), valueBPx, operator);
value = max > valueAPx ? valueAPx : max;
} else {
value = getRelativeValue(valueAPx, valueBPx, operator);
}
} else {
value = convertValueToPx($el, v, size, under, over);
}
} else {
value = /** @type {Number} */(v);
}
return round(value, 0);
}
|
@param {HTMLElement} $el
@param {ScrollThresholdValue} v
@param {Number} size
@param {Number} [under]
@param {Number} [over]
@return {Number}
|
parseBoundValue
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
updateBounds() {
if (this._debug) {
this.removeDebug();
}
let stickys;
const $target = this.target;
const container = this.container;
const isHori = this.horizontal;
const linked = this.linked;
let linkedTime;
let $el = $target;
let offsetX = 0;
let offsetY = 0;
/** @type {Element} */
let $offsetParent = $el;
if (linked) {
linkedTime = linked.currentTime;
linked.seek(0, true);
}
const isContainerStatic = getTargetValue(container.element, 'position') === 'static' ? setTargetValues(container.element, { position: 'relative '}) : false;
while ($el && $el !== container.element && $el !== doc.body) {
const isSticky = getTargetValue($el, 'position') === 'sticky' ?
setTargetValues($el, { position: 'static' }) :
false;
if ($el === $offsetParent) {
offsetX += $el.offsetLeft || 0;
offsetY += $el.offsetTop || 0;
$offsetParent = $el.offsetParent;
}
$el = /** @type {HTMLElement} */($el.parentElement);
if (isSticky) {
if (!stickys) stickys = [];
stickys.push(isSticky);
}
}
if (isContainerStatic) isContainerStatic.revert();
const offset = isHori ? offsetX : offsetY;
const targetSize = isHori ? $target.offsetWidth : $target.offsetHeight;
const containerSize = isHori ? container.width : container.height;
const scrollSize = isHori ? container.scrollWidth : container.scrollHeight;
const maxScroll = scrollSize - containerSize;
const enter = this.enter;
const leave = this.leave;
/** @type {ScrollThresholdValue} */
let enterTarget = 'start';
/** @type {ScrollThresholdValue} */
let leaveTarget = 'end';
/** @type {ScrollThresholdValue} */
let enterContainer = 'end';
/** @type {ScrollThresholdValue} */
let leaveContainer = 'start';
if (isStr(enter)) {
const splitted = /** @type {String} */(enter).split(' ');
enterContainer = splitted[0];
enterTarget = splitted.length > 1 ? splitted[1] : enterTarget;
} else if (isObj(enter)) {
const e = /** @type {ScrollThresholdParam} */(enter);
if (!isUnd(e.container)) enterContainer = e.container;
if (!isUnd(e.target)) enterTarget = e.target;
} else if (isNum(enter)) {
enterContainer = /** @type {Number} */(enter);
}
if (isStr(leave)) {
const splitted = /** @type {String} */(leave).split(' ');
leaveContainer = splitted[0];
leaveTarget = splitted.length > 1 ? splitted[1] : leaveTarget;
} else if (isObj(leave)) {
const t = /** @type {ScrollThresholdParam} */(leave);
if (!isUnd(t.container)) leaveContainer = t.container;
if (!isUnd(t.target)) leaveTarget = t.target;
} else if (isNum(leave)) {
leaveContainer = /** @type {Number} */(leave);
}
const parsedEnterTarget = parseBoundValue($target, enterTarget, targetSize);
const parsedLeaveTarget = parseBoundValue($target, leaveTarget, targetSize);
const under = (parsedEnterTarget + offset) - containerSize;
const over = (parsedLeaveTarget + offset) - maxScroll;
const parsedEnterContainer = parseBoundValue($target, enterContainer, containerSize, under, over);
const parsedLeaveContainer = parseBoundValue($target, leaveContainer, containerSize, under, over);
const offsetStart = parsedEnterTarget + offset - parsedEnterContainer;
const offsetEnd = parsedLeaveTarget + offset - parsedLeaveContainer;
const scrollDelta = offsetEnd - offsetStart;
this.offsets[0] = offsetX;
this.offsets[1] = offsetY;
this.offset = offset;
this.offsetStart = offsetStart;
this.offsetEnd = offsetEnd;
this.distance = scrollDelta <= 0 ? 0 : scrollDelta;
this.thresholds = [enterTarget, leaveTarget, enterContainer, leaveContainer];
this.coords = [parsedEnterTarget, parsedLeaveTarget, parsedEnterContainer, parsedLeaveContainer];
if (stickys) {
stickys.forEach(sticky => sticky.revert());
}
if (linked) {
linked.seek(linkedTime, true);
}
if (this._debug) {
this.debug();
}
}
|
@param {String} p
@param {Number} l
@param {Number} t
@param {Number} w
@param {Number} h
@return {String}
|
updateBounds
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
stagger = (val, params = {}) => {
let values = [];
let maxValue = 0;
const from = params.from;
const reversed = params.reversed;
const ease = params.ease;
const hasEasing = !isUnd(ease);
const hasSpring = hasEasing && !isUnd(/** @type {Spring} */(ease).ease);
const staggerEase = hasSpring ? /** @type {Spring} */(ease).ease : hasEasing ? parseEasings(ease) : null;
const grid = params.grid;
const axis = params.axis;
const fromFirst = isUnd(from) || from === 0 || from === 'first';
const fromCenter = from === 'center';
const fromLast = from === 'last';
const isRange = isArr(val);
const val1 = isRange ? parseNumber(val[0]) : parseNumber(val);
const val2 = isRange ? parseNumber(val[1]) : 0;
const unitMatch = unitsExecRgx.exec((isRange ? val[1] : val) + emptyString);
const start = params.start || 0 + (isRange ? val1 : 0);
let fromIndex = fromFirst ? 0 : isNum(from) ? from : 0;
return (_, i, t, tl) => {
if (fromCenter) fromIndex = (t - 1) / 2;
if (fromLast) fromIndex = t - 1;
if (!values.length) {
for (let index = 0; index < t; index++) {
if (!grid) {
values.push(abs(fromIndex - index));
} else {
const fromX = !fromCenter ? fromIndex % grid[0] : (grid[0] - 1) / 2;
const fromY = !fromCenter ? floor(fromIndex / grid[0]) : (grid[1] - 1) / 2;
const toX = index % grid[0];
const toY = floor(index / grid[0]);
const distanceX = fromX - toX;
const distanceY = fromY - toY;
let value = sqrt(distanceX * distanceX + distanceY * distanceY);
if (axis === 'x') value = -distanceX;
if (axis === 'y') value = -distanceY;
values.push(value);
}
maxValue = max(...values);
}
if (staggerEase) values = values.map(val => staggerEase(val / maxValue) * maxValue);
if (reversed) values = values.map(val => axis ? (val < 0) ? val * -1 : -val : abs(maxValue - val));
}
const spacing = isRange ? (val2 - val1) / maxValue : val1;
const offset = tl ? parseTimelinePosition(tl, isUnd(params.start) ? tl.iterationDuration : start) : /** @type {Number} */(start);
/** @type {String|Number} */
let output = offset + ((spacing * round(values[i], 2)) || 0);
if (params.modifier) output = params.modifier(output);
if (unitMatch) output = `${output}${unitMatch[2]}`;
return output;
}
}
|
@param {Number|String|[Number|String,Number|String]} val
@param {StaggerParameters} params
@return {StaggerFunction}
|
stagger
|
javascript
|
juliangarnier/anime
|
lib/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/lib/anime.esm.js
|
MIT
|
function createDrawableProxy($el, start, end) {
const strokeLineCap = getComputedStyle($el).strokeLinecap;
const pathLength = 100000;
let currentCap = strokeLineCap;
const proxy = new Proxy($el, {
get(target, property) {
const value = target[property];
if (property === proxyTargetSymbol) return target;
if (property === 'setAttribute') {
/** @param {any[]} args */
return (...args) => {
if (args[0] === 'draw') {
const value = args[1];
const precision = globals.precision;
const values = value.split(' ');
const v1 = round(+values[0], precision);
const v2 = round(+values[1], precision);
// TOTO: Benchmark if performing two slices is more performant than one split
// const spaceIndex = value.indexOf(' ');
// const v1 = round(+value.slice(0, spaceIndex), precision);
// const v2 = round(+value.slice(spaceIndex + 1), precision);
const os = round((v1 * -pathLength), 0);
const d1 = round((v2 * pathLength) + os, 0);
const d2 = round(pathLength - d1, 0);
// Handle cases where the cap is still visible when the line is completly hidden
if (strokeLineCap !== 'butt') {
const newCap = v1 === v2 ? 'butt' : strokeLineCap;
if (currentCap !== newCap) {
target.setAttribute('stroke-linecap', `${newCap}`);
currentCap = newCap;
}
}
target.setAttribute('stroke-dashoffset', `${os}`);
target.setAttribute('stroke-dasharray', `${d1} ${d2}`);
}
return Reflect.apply(value, target, args);
};
}
if (isFnc(value)) {
/** @param {any[]} args */
return (...args) => Reflect.apply(value, target, args);
} else {
return value;
}
}
});
if ($el.getAttribute('pathLength') !== `${pathLength}`) {
$el.setAttribute('pathLength', `${pathLength}`);
proxy.setAttribute('draw', `${start} ${end}`);
}
return /** @type {typeof Proxy} */(/** @type {unknown} */(proxy));
}
|
@param {SVGGeometryElement} $el
@param {Number} start
@param {Number} end
@return {Proxy}
|
createDrawableProxy
|
javascript
|
juliangarnier/anime
|
tests/playground/assets/js/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js
|
MIT
|
createDrawable = (selector, start = 0, end = 0) => {
const els = /** @type {Array.<Proxy>} */((/** @type {unknown} */(parseTargets(selector))));
els.forEach(($el, i) => els[i] = createDrawableProxy(/** @type {SVGGeometryElement} */(/** @type {unknown} */($el)), start, end));
return els;
}
|
@param {TargetsParam} selector
@param {Number} [start=0]
@param {Number} [end=0]
@return {Array.<Proxy>}
|
createDrawable
|
javascript
|
juliangarnier/anime
|
tests/playground/assets/js/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js
|
MIT
|
revert() {
tick(this, 0, 1, 0, tickModes.FORCE);
// this.cancel();
return this.cancel();
}
|
Cancel the timer by seeking it back to 0 and reverting the attached scroller if necessary
@return {this}
|
revert
|
javascript
|
juliangarnier/anime
|
tests/playground/assets/js/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js
|
MIT
|
setTargetValues = (targets, parameters) => {
if (isUnd(parameters)) return;
parameters.duration = minValue;
// Do not overrides currently active tweens by default
parameters.composition = setValue(parameters.composition, compositionTypes.none);
// Skip init() and force rendering by playing the animation
return new Animation(targets, parameters, null, 0, true).play();
}
|
@param {TargetsParam} targets
@param {AnimationParams} parameters
@return {Animation}
|
setTargetValues
|
javascript
|
juliangarnier/anime
|
tests/playground/assets/js/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js
|
MIT
|
removeTargetsFromAnimation = (targetsArray, animation, propertyName) => {
let tweensMatchesTargets = false;
forEachChildren(animation, (/**@type {Tween} */tween) => {
const tweenTarget = tween.target;
if (targetsArray.includes(tweenTarget)) {
const tweenName = tween.property;
const tweenType = tween._tweenType;
const normalizePropName = sanitizePropertyName(propertyName, tweenTarget, tweenType);
if (!normalizePropName || normalizePropName && normalizePropName === tweenName) {
// Removes the tween from the selected animation
removeChild(animation, tween);
// Detach the tween from its siblings to make sure blended tweens are correctlly removed
removeTweenSliblings(tween);
tweensMatchesTargets = true;
}
}
}, true);
return tweensMatchesTargets;
}
|
@param {TargetsArray} targetsArray
@param {Animation} animation
@param {String} [propertyName]
@return {Boolean}
|
removeTargetsFromAnimation
|
javascript
|
juliangarnier/anime
|
tests/playground/assets/js/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js
|
MIT
|
remove = (targets, renderable, propertyName) => {
const targetsArray = parseTargets(targets);
const parent = renderable ? renderable : engine;
let removeMatches;
if (parent._hasChildren) {
forEachChildren(parent, (/** @type {Renderable} */child) => {
if (!child._hasChildren) {
removeMatches = removeTargetsFromAnimation(targetsArray, /** @type {Animation} */(child), propertyName);
// Remove the child from its parent if no tweens and no children left after the removal
if (removeMatches && !child._head) {
// TODO: Call child.onInterupt() here when implemented
child.cancel();
removeChild(parent, child);
}
}
// Make sure to also remove engine's children targets
// NOTE: Avoid recursion?
if (child._head) {
remove(targets, child);
} else {
child._hasChildren = false;
}
}, true);
} else {
removeMatches = removeTargetsFromAnimation(
targetsArray,
/** @type {Animation} */(parent),
propertyName
);
}
if (removeMatches && !parent._head) {
parent._hasChildren = false;
// TODO: Call child.onInterupt() here when implemented
// Cancel the parent if there are no tweens and no children left after the removal
// We have to check if the .cancel() method exist to handle cases where the parent is the engine itself
if (/** @type {Renderable} */(parent).cancel) /** @type {Renderable} */(parent).cancel();
}
return targetsArray;
}
|
@param {TargetsParam} targets
@param {Renderable} [renderable]
@param {String} [propertyName]
@return {TargetsArray}
|
remove
|
javascript
|
juliangarnier/anime
|
tests/playground/assets/js/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js
|
MIT
|
function addTlChild(childParams, tl, parsedTLPosition, targets, index, length) {
// Offset the tl position with -minValue for 0 duration animations or .set() calls in order to align their end value with the defined position
const TLPosition = isNum(childParams.duration) && /** @type {Number} */(childParams.duration) <= minValue ? parsedTLPosition - minValue : parsedTLPosition;
tick(tl, TLPosition, 1, 1, tickModes.AUTO);
const tlChild = targets ?
new Animation(targets,/** @type {AnimationParams} */(childParams), tl, TLPosition, false, index, length) :
new Timer(/** @type {TimerParams} */(childParams), tl, TLPosition);
tlChild.init(1);
// TODO: Might be better to insert at a position relative to startTime?
addChild(tl, tlChild);
forEachChildren(tl, (/** @type {Renderable} */child) => {
const childTLOffset = child._offset + child._delay;
const childDur = childTLOffset + child.duration;
if (childDur > tl._iterationDuration) {
tl._iterationDuration = childDur;
}
});
tl.duration = clampInfinity(((tl._iterationDuration + tl._loopDelay) * tl._iterationCount) - tl._loopDelay) || minValue;
return tl;
}
|
@overload
@param {TimerParams} childParams
@param {Timeline} tl
@param {Number} parsedTLPosition
@return {Timeline}
@overload
@param {AnimationParams} childParams
@param {Timeline} tl
@param {Number} parsedTLPosition
@param {TargetsParam} targets
@param {Number} [index]
@param {Number} [length]
@return {Timeline}
@param {TimerParams|AnimationParams} childParams
@param {Timeline} tl
@param {Number} parsedTLPosition
@param {TargetsParam} [targets]
@param {Number} [index]
@param {Number} [length]
|
addTlChild
|
javascript
|
juliangarnier/anime
|
tests/playground/assets/js/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js
|
MIT
|
add(a1, a2, a3) {
const isAnim = isObj(a2);
const isTimer = isObj(a1);
const isFunc = isFnc(a1);
if (isAnim || isTimer || isFunc) {
this._hasChildren = true;
if (isAnim) {
const childParams = /** @type {AnimationParams} */(a2);
// Check for function for children stagger positions
if (isFnc(a3)) {
const staggeredPosition = /** @type {Function} */(a3);
const parsedTargetsArray = parseTargets(/** @type {TargetsParam} */(a1));
// Store initial duration before adding new children that will change the duration
const tlDuration = this.duration;
// Store initial _iterationDuration before adding new children that will change the duration
const tlIterationDuration = this._iterationDuration;
// Store the original id in order to add specific indexes to the new animations ids
const id = childParams.id;
let i = 0;
const parsedLength = parsedTargetsArray.length;
parsedTargetsArray.forEach((/** @type {Target} */target) => {
// Create a new parameter object for each staggered children
const staggeredChildParams = { ...childParams };
// Reset the duration of the timeline iteration before each stagger to prevent wrong start value calculation
this.duration = tlDuration;
this._iterationDuration = tlIterationDuration;
if (!isUnd(id)) staggeredChildParams.id = id + '-' + i;
addTlChild(
staggeredChildParams,
this,
staggeredPosition(target, i, parsedLength, this),
target,
i,
parsedLength
);
i++;
});
} else {
addTlChild(
childParams,
this,
parseTimelinePosition(this, a3),
/** @type {TargetsParam} */(a1),
);
}
} else {
// It's a Timer or a Function
addTlChild(
/** @type TimerParams */(isTimer ? a1 : { onComplete: a1, duration: minValue }),
this,
parseTimelinePosition(this,/** @type TimePosition */(a2)),
);
}
this.init(1); // 1 = internalRender
return this._autoplay === true ? this.play() : this;
} else if (isStr(a1)) {
this.labels[a1] = parseTimelinePosition(this,/** @type TimePosition */(a2));
return this;
}
}
|
@overload
@param {TargetsParam} a1
@param {AnimationParams} a2
@param {TimePosition} [a3]
@return {this}
@overload
@param {TimerParams} a1
@param {TimePosition} [a2]
@return {this}
@overload
@param {String} a1
@param {TimePosition} [a2]
@return {this}
@overload
@param {TimerCallback} a1
@param {TimePosition} [a2]
@return {this}
@param {TargetsParam|TimerParams|String|TimerCallback} a1
@param {AnimationParams|TimePosition} a2
@param {TimePosition} [a3]
|
add
|
javascript
|
juliangarnier/anime
|
tests/playground/assets/js/anime.esm.js
|
https://github.com/juliangarnier/anime/blob/master/tests/playground/assets/js/anime.esm.js
|
MIT
|
constructor(request, response, jobs, config) {
const tokens = Object.keys(jobs);
this.config = config;
this.plugins = config.plugins;
this.error = null;
this.statusCode = 200;
// An object that all of the contexts will inherit from... one per instance.
this.baseContext = {
request,
response,
batchMeta: {},
};
// An object that will be passed into the context for batch-level methods, but not for job-level
// methods.
this.batchContext = {
tokens,
jobs,
};
// A map of token => JobContext, where JobContext is an object of data that is per-job,
// and will be passed into plugins and used for the final result.
this.jobContexts = tokens.reduce((obj, token) => {
const { name, data, metadata } = jobs[token];
/* eslint no-param-reassign: 1 */
obj[token] = {
name,
token,
props: data,
metadata,
statusCode: 200,
duration: null,
html: null,
returnMeta: {},
};
return obj;
}, {});
// Each plugin receives it's own little key-value data store that is scoped privately
// to the plugin for the life time of the request. This is achieved simply through lexical
// closure.
this.pluginContexts = new Map();
this.plugins.forEach((plugin) => {
this.pluginContexts.set(plugin, { data: new Map() });
});
}
|
The BatchManager is a class that is instantiated once per batch, and holds a lot of the
key data needed throughout the life of the request. This ends up cleaning up some of the
management needed for plugin lifecycle, and the handling of rendering multiple jobs in a
batch.
@param {express.Request} req
@param {express.Response} res
@param {Object} jobs - a map of token => Job
@param {Object} config
@constructor
|
constructor
|
javascript
|
airbnb/hypernova
|
src/utils/BatchManager.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/BatchManager.js
|
MIT
|
getRequestContext(plugin, token) {
return {
...this.baseContext,
...this.jobContexts[token],
...this.pluginContexts.get(plugin),
};
}
|
Returns a context object scoped to a specific plugin and job (based on the plugin and
job token passed in).
|
getRequestContext
|
javascript
|
airbnb/hypernova
|
src/utils/BatchManager.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/BatchManager.js
|
MIT
|
getBatchContext(plugin) {
return {
...this.baseContext,
...this.batchContext,
...this.pluginContexts.get(plugin),
};
}
|
Returns a context object scoped to a specific plugin and batch.
|
getBatchContext
|
javascript
|
airbnb/hypernova
|
src/utils/BatchManager.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/BatchManager.js
|
MIT
|
render(token) {
const start = now();
const context = this.jobContexts[token];
const { name } = context;
const { getComponent } = this.config;
const result = getComponent(name, context);
return Promise.resolve(result).then((renderFn) => {
// ensure that we have this component registered
if (!renderFn || typeof renderFn !== 'function') {
// component not registered
context.statusCode = 404;
return Promise.reject(notFound(name));
}
return renderFn(context.props);
}).then((html) => { // eslint-disable-line consistent-return
if (!html) {
return Promise.reject(noHTMLError);
}
context.html = html;
context.duration = msSince(start);
}).catch((err) => {
context.duration = msSince(start);
return Promise.reject(err);
});
}
|
Renders a specific job (from a job token). The end result is applied to the corresponding
job context. Additionally, duration is calculated.
|
render
|
javascript
|
airbnb/hypernova
|
src/utils/BatchManager.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/BatchManager.js
|
MIT
|
function hasMethod(name) {
return (obj) => typeof obj[name] === 'function';
}
|
Returns a predicate function to filter objects based on whether a method of the provided
name is present.
@param {String} name - the method name to find
@returns {Function} - the resulting predicate function
|
hasMethod
|
javascript
|
airbnb/hypernova
|
src/utils/lifecycle.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/lifecycle.js
|
MIT
|
function raceTo(promise, ms, msg) {
let timeout;
return Promise.race([
promise,
new Promise((resolve) => {
timeout = setTimeout(() => resolve(PROMISE_TIMEOUT), ms);
}),
]).then((res) => {
if (res === PROMISE_TIMEOUT) logger.info(msg, { timeout: ms });
if (timeout) clearTimeout(timeout);
return res;
}).catch((err) => {
if (timeout) clearTimeout(timeout);
return Promise.reject(err);
});
}
|
Creates a promise that resolves at the specified number of ms.
@param ms
@returns {Promise}
|
raceTo
|
javascript
|
airbnb/hypernova
|
src/utils/lifecycle.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/lifecycle.js
|
MIT
|
function runAppLifecycle(lifecycle, plugins, config, error, ...args) {
try {
const promise = Promise.all(
plugins.filter(hasMethod(lifecycle)).map((plugin) => plugin[lifecycle](config, error, ...args)),
);
return raceTo(
promise,
MAX_LIFECYCLE_EXECUTION_TIME_IN_MS,
`App lifecycle method ${lifecycle} took too long.`,
);
} catch (err) {
return Promise.reject(err);
}
}
|
Iterates through the plugins and calls the specified asynchronous lifecycle event,
returning a promise that resolves when they all are completed, or rejects if one of them
fails.
The third `config` param gets passed into the lifecycle methods as the first argument. In
this case, the app lifecycle events expect the config instance to be passed in.
This function is currently used for the lifecycle events `initialize` and `shutdown`.
@param {String} lifecycle
@param {Array<HypernovaPlugin>} plugins
@param {Config} config
@returns {Promise}
@param err {Error}
|
runAppLifecycle
|
javascript
|
airbnb/hypernova
|
src/utils/lifecycle.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/lifecycle.js
|
MIT
|
function runLifecycle(lifecycle, plugins, manager, token) {
try {
const promise = Promise.all(
plugins
.filter(hasMethod(lifecycle))
.map((plugin) => plugin[lifecycle](manager.contextFor(plugin, token))),
);
return raceTo(
promise,
MAX_LIFECYCLE_EXECUTION_TIME_IN_MS,
`Lifecycle method ${lifecycle} took too long.`,
);
} catch (err) {
return Promise.reject(err);
}
}
|
Iterates through the plugins and calls the specified asynchronous lifecycle event,
returning a promise that resolves when they are all completed, or rejects if one of them
fails.
This is meant to be used on lifecycle events both at the batch level and the job level. The
passed in BatchManager is used to get the corresponding context object for the plugin/job and
is passed in as the first argument to the plugin's method.
This function is currently used for `batchStart/End` and `jobStart/End`.
@param {String} lifecycle
@param {Array<HypernovaPlugin>} plugins
@param {BatchManager} manager
@param {String} [token] - If provided, the job token to use to get the context
@returns {Promise}
|
runLifecycle
|
javascript
|
airbnb/hypernova
|
src/utils/lifecycle.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/lifecycle.js
|
MIT
|
function runLifecycleSync(lifecycle, plugins, manager, token) {
plugins
.filter(hasMethod(lifecycle))
.forEach((plugin) => plugin[lifecycle](manager.contextFor(plugin, token)));
}
|
Iterates through the plugins and calls the specified synchronous lifecycle event (when present).
Passes in the appropriate context object for the plugin/job.
This function is currently being used for `afterRender` and `beforeRender`.
@param {String} lifecycle
@param {Array<HypernovaPlugin>} plugins
@param {BatchManager} manager
@param {String} [token]
|
runLifecycleSync
|
javascript
|
airbnb/hypernova
|
src/utils/lifecycle.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/lifecycle.js
|
MIT
|
function errorSync(err, plugins, manager, token) {
plugins
.filter(hasMethod('onError'))
.forEach((plugin) => plugin.onError(manager.contextFor(plugin, token), err));
}
|
Iterates through the plugins and calls the specified synchronous `onError` handler
(when present).
Passes in the appropriate context object, as well as the error.
@param {Error} err
@param {Array<HypernovaPlugin>} plugins
@param {BatchManager} manager
@param {String} [token]
|
errorSync
|
javascript
|
airbnb/hypernova
|
src/utils/lifecycle.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/lifecycle.js
|
MIT
|
function processJob(token, plugins, manager) {
return (
// jobStart
runLifecycle('jobStart', plugins, manager, token)
.then(() => {
// beforeRender
runLifecycleSync('beforeRender', plugins, manager, token);
// render
return manager.render(token);
})
// jobEnd
.then(() => {
// afterRender
runLifecycleSync('afterRender', plugins, manager, token);
return runLifecycle('jobEnd', plugins, manager, token);
})
.catch((err) => {
manager.recordError(err, token);
errorSync(err, plugins, manager, token);
})
);
}
|
Runs through the job-level lifecycle events of the job based on the provided token. This includes
the actual rendering of the job.
Returns a promise resolving when the job completes.
@param {String} token
@param {Array<HypernovaPlugin>} plugins
@param {BatchManager} manager
@returns {Promise}
|
processJob
|
javascript
|
airbnb/hypernova
|
src/utils/lifecycle.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/lifecycle.js
|
MIT
|
function processBatch(jobs, plugins, manager, concurrent) {
return (
// batchStart
runLifecycle('batchStart', plugins, manager)
// for each job, processJob
.then(() => {
if (concurrent) {
return processJobsConcurrently(jobs, plugins, manager);
}
return processJobsSerially(jobs, plugins, manager);
})
// batchEnd
.then(() => runLifecycle('batchEnd', plugins, manager))
.catch((err) => {
manager.recordError(err);
errorSync(err, plugins, manager);
})
);
}
|
Runs through the batch-level lifecycle events of a batch. This includes the processing of each
individual job.
Returns a promise resolving when all jobs in the batch complete.
@param jobs
@param {Array<HypernovaPlugin>} plugins
@param {BatchManager} manager
@returns {Promise}
|
processBatch
|
javascript
|
airbnb/hypernova
|
src/utils/lifecycle.js
|
https://github.com/airbnb/hypernova/blob/master/src/utils/lifecycle.js
|
MIT
|
function callbackWrapper(error, applicationCache)
{
if (error) {
console.error(error);
callback(null);
return;
}
callback(applicationCache);
}
|
@param {string} frameId
@param {function(Object)} callback
|
callbackWrapper
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ApplicationCacheModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ApplicationCacheModel.js
|
MIT
|
function evalCallback(styleSheets) {
if (progressMonitor.canceled)
return;
if (!styleSheets.length)
return callback(null);
var pseudoSelectorRegexp = /:hover|:link|:active|:visited|:focus|:before|:after/;
var selectors = [];
var testedSelectors = {};
for (var i = 0; i < styleSheets.length; ++i) {
var styleSheet = styleSheets[i];
for (var curRule = 0; curRule < styleSheet.rules.length; ++curRule) {
var selectorText = styleSheet.rules[curRule].selectorText;
if (selectorText.match(pseudoSelectorRegexp) || testedSelectors[selectorText])
continue;
selectors.push(selectorText);
testedSelectors[selectorText] = 1;
}
}
function selectorsCallback(callback, styleSheets, testedSelectors, foundSelectors)
{
if (progressMonitor.canceled)
return;
var inlineBlockOrdinal = 0;
var totalStylesheetSize = 0;
var totalUnusedStylesheetSize = 0;
var summary;
for (var i = 0; i < styleSheets.length; ++i) {
var styleSheet = styleSheets[i];
var stylesheetSize = 0;
var unusedStylesheetSize = 0;
var unusedRules = [];
for (var curRule = 0; curRule < styleSheet.rules.length; ++curRule) {
var rule = styleSheet.rules[curRule];
// Exact computation whenever source ranges are available.
var textLength = (rule.selectorRange && rule.style.range && rule.style.range.end) ? rule.style.range.end - rule.selectorRange.start + 1 : 0;
if (!textLength && rule.style.cssText)
textLength = rule.style.cssText.length + rule.selectorText.length;
stylesheetSize += textLength;
if (!testedSelectors[rule.selectorText] || foundSelectors[rule.selectorText])
continue;
unusedStylesheetSize += textLength;
unusedRules.push(rule.selectorText);
}
totalStylesheetSize += stylesheetSize;
totalUnusedStylesheetSize += unusedStylesheetSize;
if (!unusedRules.length)
continue;
var resource = WebInspector.resourceForURL(styleSheet.sourceURL);
var isInlineBlock = resource && resource.type == WebInspector.Resource.Type.Document;
var url = !isInlineBlock ? WebInspector.AuditRuleResult.linkifyDisplayName(styleSheet.sourceURL) : String.sprintf("Inline block #%d", ++inlineBlockOrdinal);
var pctUnused = Math.round(100 * unusedStylesheetSize / stylesheetSize);
if (!summary)
summary = result.addChild("", true);
var entry = summary.addFormatted("%s: %s (%d%) is not used by the current page.", url, Number.bytesToString(unusedStylesheetSize), pctUnused);
for (var j = 0; j < unusedRules.length; ++j)
entry.addSnippet(unusedRules[j]);
result.violationCount += unusedRules.length;
}
if (!totalUnusedStylesheetSize)
return callback(null);
var totalUnusedPercent = Math.round(100 * totalUnusedStylesheetSize / totalStylesheetSize);
summary.value = String.sprintf("%s (%d%) of CSS is not used by the current page.", Number.bytesToString(totalUnusedStylesheetSize), totalUnusedPercent);
callback(result);
}
var foundSelectors = {};
function queryCallback(boundSelectorsCallback, selector, styleSheets, testedSelectors, nodeId)
{
if (nodeId)
foundSelectors[selector] = true;
if (boundSelectorsCallback)
boundSelectorsCallback(foundSelectors);
}
function documentLoaded(selectors, document) {
for (var i = 0; i < selectors.length; ++i) {
if (progressMonitor.canceled)
return;
WebInspector.domAgent.querySelector(document.id, selectors[i], queryCallback.bind(null, i === selectors.length - 1 ? selectorsCallback.bind(null, callback, styleSheets, testedSelectors) : null, selectors[i], styleSheets, testedSelectors));
}
}
WebInspector.domAgent.requestDocument(documentLoaded.bind(null, selectors));
}
|
The reported CSS rule size is incorrect (parsed != original in WebKit),
so use percentages instead, which gives a better approximation.
@constructor
@extends {WebInspector.AuditRule}
|
evalCallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/AuditRules.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/AuditRules.js
|
MIT
|
function binarySearch(object, array, comparator)
{
var first = 0;
var last = array.length - 1;
while (first <= last) {
var mid = (first + last) >> 1;
var c = comparator(object, array[mid]);
if (c > 0)
first = mid + 1;
else if (c < 0)
last = mid - 1;
else
return mid;
}
// Return the nearest lesser index, "-1" means "0, "-2" means "1", etc.
return -(first + 1);
}
|
@param {*} object
@param {Array.<*>} array
@param {function(*, *)} comparator
|
binarySearch
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/BinarySearch.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/BinarySearch.js
|
MIT
|
function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction)
{
var index = binarySearch(anObject, aList, aFunction);
if (index < 0)
// See binarySearch implementation.
return -index - 1;
else {
// Return the first occurance of an item in the list.
while (index > 0 && aFunction(anObject, aList[index - 1]) === 0)
index--;
return index;
}
}
|
@param {*} anObject
@param {Array.<*>} aList
@param {function(*, *)} aFunction
|
insertionIndexForObjectInListSortedByFunction
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/BinarySearch.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/BinarySearch.js
|
MIT
|
function didSetBreakpoint(breakpointId, locations)
{
if (breakpoint === this._breakpoint(breakpoint.uiSourceCodeId, breakpoint.lineNumber)) {
if (!breakpointId) {
if (breakpoint.uiBreakpoint)
this._removeBreakpointFromUI(breakpoint.uiBreakpoint);
this._removeBreakpointFromModel(breakpoint);
return;
}
} else {
if (breakpointId)
this._debuggerModel.removeBreakpoint(breakpointId);
return;
}
this._breakpointsByDebuggerId[breakpointId] = breakpoint;
breakpoint._debuggerId = breakpointId;
breakpoint._debuggerLocation = locations[0];
if (breakpoint._debuggerLocation)
this._breakpointDebuggerLocationChanged(breakpoint);
}
|
@this {WebInspector.BreakpointManager}
@param {DebuggerAgent.BreakpointId} breakpointId
@param {Array.<DebuggerAgent.Location>} locations
|
didSetBreakpoint
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/BreakpointManager.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/BreakpointManager.js
|
MIT
|
function serializePersistent(breakpoint)
{
if (breakpoint.persistent)
serializedBreakpoints.push(breakpoint.serialize());
}
|
@this {WebInspector.BreakpointManager}
@param {WebInspector.Breakpoint} breakpoint
|
serializePersistent
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/BreakpointManager.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/BreakpointManager.js
|
MIT
|
function hueToRGB(p, q, h) {
if (h < 0)
h += 1;
else if (h > 1)
h -= 1;
if ((h * 6) < 1)
return p + (q - p) * h * 6;
else if ((h * 2) < 1)
return q;
else if ((h * 3) < 2)
return p + (q - p) * ((2 / 3) - h) * 6;
else
return p;
}
|
@param {Array.<number>} hsl
@return {Array.<number>}
|
hueToRGB
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/Color.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/Color.js
|
MIT
|
get message()
{
// force message formatting
var formattedMessage = this.formattedMessage;
return this._message;
}
|
@constructor
@extends {WebInspector.ConsoleMessage}
@param {string} source
@param {string} level
@param {string} message
@param {WebInspector.DebuggerPresentationModel.Linkifier} linkifier
@param {string=} type
@param {string=} url
@param {number=} line
@param {number=} repeatCount
@param {Array.<RuntimeAgent.RemoteObject>=} parameters
@param {ConsoleAgent.StackTrace=} stackTrace
@param {WebInspector.Resource=} request
|
message
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ConsoleMessage.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ConsoleMessage.js
|
MIT
|
function createDividerElement() {
var dividerElement = document.createElement("div");
dividerElement.addStyleClass("scope-bar-divider");
this._filterBarElement.appendChild(dividerElement);
}
|
@extends {WebInspector.View}
@constructor
@param {boolean} hideContextSelector
|
createDividerElement
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ConsoleView.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ConsoleView.js
|
MIT
|
function evalCallback(error, result, wasThrown)
{
if (error) {
console.error(error);
callback(null, false);
return;
}
if (returnByValue)
callback(null, wasThrown, wasThrown ? null : result);
else
callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
}
|
@param {string} expression
@param {string} objectGroup
@param {boolean} includeCommandLineAPI
@param {boolean} doNotPauseOnExceptions
@param {boolean} returnByValue
@param {function(?WebInspector.RemoteObject, boolean, RuntimeAgent.RemoteObject=)} callback
|
evalCallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ConsoleView.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ConsoleView.js
|
MIT
|
function searchCallback(script, searchMatches)
{
results[script.scriptId] = [];
for (var i = 0; i < searchMatches.length; ++i) {
var searchMatch = new WebInspector.ContentProvider.SearchMatch(searchMatches[i].lineNumber + script.lineOffset, searchMatches[i].lineContent);
results[script.scriptId].push(searchMatch);
}
scriptsLeft--;
maybeCallback.call(this);
}
|
@param {WebInspector.Script} script
@param {Array.<PageAgent.SearchMatch>} searchMatches
|
searchCallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ContentProviders.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ContentProviders.js
|
MIT
|
function performSearch()
{
var regex = createSearchRegex(query, caseSensitive, isRegex);
var result = [];
var lineEndings = this._content.lineEndings();
for (var i = 0; i < lineEndings.length; ++i) {
var lineStart = i > 0 ? lineEndings[i - 1] + 1 : 0;
var lineEnd = lineEndings[i];
var lineContent = this._content.substring(lineStart, lineEnd);
if (lineContent.length > 0 && lineContent.charAt(lineContent.length - 1) === "\r")
lineContent = lineContent.substring(0, lineContent.length - 1)
if (regex.exec(lineContent))
result.push(new WebInspector.ContentProvider.SearchMatch(i, lineContent));
}
callback(result);
}
|
@param {string} query
@param {boolean} caseSensitive
@param {boolean} isRegex
@param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback
|
performSearch
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ContentProviders.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ContentProviders.js
|
MIT
|
get selectedCookie()
{
var node = this._dataGrid.selectedNode;
return node ? node.cookie : null;
}
|
@constructor
@extends {WebInspector.View}
@param {function(PageAgent.Cookie)=} deleteCallback
@param {function()=} refreshCallback
|
selectedCookie
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CookiesTable.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CookiesTable.js
|
MIT
|
get data()
{
var data = {};
data.selector = this._data.selector;
data.matches = this._data.matchCount;
if (this._profileView.showTimeAsPercent.get())
data.time = Number(this._data.timePercent).toFixed(1) + "%";
else
data.time = Number.secondsToString(this._data.time / 1000, true);
return data;
}
|
@constructor
@extends WebInspector.DataGridNode
@param {WebInspector.CSSSelectorProfileView} profileView
|
data
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSSelectorProfileView.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSSelectorProfileView.js
|
MIT
|
get statusBarItems()
{
return [this.percentButton.element];
}
|
@constructor
@extends WebInspector.View
@param {CSSAgent.SelectorProfile} profile
|
statusBarItems
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSSelectorProfileView.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSSelectorProfileView.js
|
MIT
|
function callback(userCallback, error, matchedPayload, pseudoPayload, inheritedPayload)
{
if (error) {
if (userCallback)
userCallback(null);
return;
}
var result = {};
if (matchedPayload)
result.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(matchedPayload);
if (pseudoPayload) {
result.pseudoElements = [];
for (var i = 0; i < pseudoPayload.length; ++i) {
var entryPayload = pseudoPayload[i];
result.pseudoElements.push({ pseudoId: entryPayload.pseudoId, rules: WebInspector.CSSStyleModel.parseRuleArrayPayload(entryPayload.rules) });
}
}
if (inheritedPayload) {
result.inherited = [];
for (var i = 0; i < inheritedPayload.length; ++i) {
var entryPayload = inheritedPayload[i];
var entry = {};
if (entryPayload.inlineStyle)
entry.inlineStyle = WebInspector.CSSStyleDeclaration.parsePayload(entryPayload.inlineStyle);
if (entryPayload.matchedCSSRules)
entry.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(entryPayload.matchedCSSRules);
result.inherited.push(entry);
}
}
if (userCallback)
userCallback(result);
}
|
@param {function(?*)} userCallback
@param {?Protocol.Error} error
@param {Array.<CSSAgent.CSSRule>=} matchedPayload
@param {Array.<CSSAgent.PseudoIdRules>=} pseudoPayload
@param {Array.<CSSAgent.InheritedStyleEntry>=} inheritedPayload
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSStyleModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSStyleModel.js
|
MIT
|
function callback(userCallback, error, inlinePayload, attributesStylePayload)
{
if (error || !inlinePayload)
userCallback(null, null);
else
userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload), attributesStylePayload ? WebInspector.CSSStyleDeclaration.parsePayload(attributesStylePayload) : null);
}
|
@param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSStyleModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSStyleModel.js
|
MIT
|
function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
{
if (!selectedNodeIds)
return;
var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
var rule = WebInspector.CSSRule.parsePayload(rulePayload);
successCallback(rule, doesAffectSelectedNode);
}
|
@param {DOMAgent.NodeId} nodeId
@param {function(WebInspector.CSSRule, boolean)} successCallback
@param {*} rulePayload
@param {?Array.<DOMAgent.NodeId>} selectedNodeIds
|
checkAffectsCallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSStyleModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSStyleModel.js
|
MIT
|
function callback(nodeId, successCallback, failureCallback, newSelector, error, rulePayload)
{
this._pendingCommandsMajorState.pop();
if (error)
failureCallback();
else {
WebInspector.domAgent.markUndoableState();
var ownerDocumentId = this._ownerDocumentId(nodeId);
if (ownerDocumentId)
WebInspector.domAgent.querySelectorAll(ownerDocumentId, newSelector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
else
failureCallback();
}
}
|
@param {DOMAgent.NodeId} nodeId
@param {function(WebInspector.CSSRule, boolean)} successCallback
@param {function()} failureCallback
@param {?Protocol.Error} error
@param {string} newSelector
@param {*=} rulePayload
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSStyleModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSStyleModel.js
|
MIT
|
function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
{
if (!selectedNodeIds)
return;
var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
var rule = WebInspector.CSSRule.parsePayload(rulePayload);
successCallback(rule, doesAffectSelectedNode);
}
|
@param {DOMAgent.NodeId} nodeId
@param {string} selector
@param {function(WebInspector.CSSRule, boolean)} successCallback
@param {function()} failureCallback
|
checkAffectsCallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSStyleModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSStyleModel.js
|
MIT
|
function callback(successCallback, failureCallback, selector, error, rulePayload)
{
this._pendingCommandsMajorState.pop();
if (error) {
// Invalid syntax for a selector
failureCallback();
} else {
WebInspector.domAgent.markUndoableState();
var ownerDocumentId = this._ownerDocumentId(nodeId);
if (ownerDocumentId)
WebInspector.domAgent.querySelectorAll(ownerDocumentId, selector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
else
failureCallback();
}
}
|
@param {function(WebInspector.CSSRule, boolean)} successCallback
@param {function()} failureCallback
@param {string} selector
@param {?Protocol.Error} error
@param {?CSSAgent.CSSRule} rulePayload
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSStyleModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSStyleModel.js
|
MIT
|
function enabledCallback(style)
{
if (userCallback)
userCallback(style);
}
|
Replaces "propertyName: propertyValue [!important];" in the stylesheet by an arbitrary propertyText.
@param {string} propertyText
@param {boolean} majorChange
@param {boolean} overwrite
@param {Function=} userCallback
|
enabledCallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSStyleModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSStyleModel.js
|
MIT
|
function callback(error, stylePayload)
{
WebInspector.cssModel._pendingCommandsMajorState.pop();
if (error) {
if (userCallback)
userCallback(null);
return;
}
WebInspector.domAgent.markUndoableState();
if (userCallback) {
var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
userCallback(style);
}
}
|
@param {string} newValue
@param {boolean} majorChange
@param {boolean} overwrite
@param {Function=} userCallback
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/CSSStyleModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/CSSStyleModel.js
|
MIT
|
function callback(error, success, transactionId)
{
if (error) {
onError(error);
return;
}
if (!success) {
onError(WebInspector.UIString("Database not found."));
return;
}
WebInspector.DatabaseDispatcher._callbacks[transactionId] = {"onSuccess": onSuccess, "onError": onError};
}
|
@param {string} query
@param {function(Array.<string>, Array.<*>)} onSuccess
@param {function(DatabaseAgent.Error)} onError
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/Database.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/Database.js
|
MIT
|
function sortDataGrid()
{
var nodes = dataGrid.children.slice();
var sortColumnIdentifier = dataGrid.sortColumnIdentifier;
var sortDirection = dataGrid.sortOrder === "ascending" ? 1 : -1;
var columnIsNumeric = true;
for (var i = 0; i < nodes.length; i++) {
if (isNaN(Number(nodes[i].data[sortColumnIdentifier])))
columnIsNumeric = false;
}
function comparator(dataGridNode1, dataGridNode2)
{
var item1 = dataGridNode1.data[sortColumnIdentifier];
var item2 = dataGridNode2.data[sortColumnIdentifier];
var comparison;
if (columnIsNumeric) {
// Sort numbers based on comparing their values rather than a lexicographical comparison.
var number1 = parseFloat(item1);
var number2 = parseFloat(item2);
comparison = number1 < number2 ? -1 : (number1 > number2 ? 1 : 0);
} else
comparison = item1 < item2 ? -1 : (item1 > item2 ? 1 : 0);
return sortDirection * comparison;
}
nodes.sort(comparator);
dataGrid.removeChildren();
for (var i = 0; i < nodes.length; i++)
dataGrid.appendChild(nodes[i]);
}
|
@param {Array.<string>} columnNames
@param {Array.<string>} values
|
sortDataGrid
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DataGrid.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DataGrid.js
|
MIT
|
get element()
{
if (this._element)
return this._element;
if (!this.dataGrid)
return null;
this._element = document.createElement("tr");
this._element._dataGridNode = this;
if (this.hasChildren)
this._element.addStyleClass("parent");
if (this.expanded)
this._element.addStyleClass("expanded");
if (this.selected)
this._element.addStyleClass("selected");
if (this.revealed)
this._element.addStyleClass("revealed");
this.createCells();
return this._element;
}
|
@constructor
@extends {WebInspector.Object}
@param {boolean=} hasChildren
|
element
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DataGrid.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DataGrid.js
|
MIT
|
function callback(error, result)
{
this._canSetScriptSource = result;
}
|
@constructor
@extends {DebuggerAgent.Location}
@param {WebInspector.Script} script
@param {number} lineNumber
@param {number} columnNumber
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerModel.js
|
MIT
|
function didSetBreakpoint(error, breakpointId, locations)
{
if (callback)
callback(error ? null : breakpointId, locations);
}
|
@this {WebInspector.DebuggerModel}
@param {?Protocol.Error} error
@param {DebuggerAgent.BreakpointId} breakpointId
@param {Array.<DebuggerAgent.Location>=} locations
|
didSetBreakpoint
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerModel.js
|
MIT
|
function didSetBreakpoint(error, breakpointId, actualLocation)
{
if (callback)
callback(error ? null : breakpointId, [actualLocation]);
}
|
@this {WebInspector.DebuggerModel}
@param {?Protocol.Error} error
@param {DebuggerAgent.BreakpointId} breakpointId
@param {DebuggerAgent.Location} actualLocation
|
didSetBreakpoint
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerModel.js
|
MIT
|
function didEditScriptSource(error)
{
callback(error);
if (error)
return;
var resource = WebInspector.resourceForURL(script.sourceURL);
if (resource)
resource.addRevision(newSource);
uiSourceCode.contentChanged(newSource);
if (WebInspector.debuggerModel.callFrames)
this._debuggerPaused();
}
|
@this {WebInspector.DebuggerPresentationModel}
@param {?Protocol.Error} error
|
didEditScriptSource
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
MIT
|
function updateLocation(uiLocation)
{
var presentationMessage = new WebInspector.PresentationConsoleMessage(uiLocation.uiSourceCode, uiLocation.lineNumber, message);
this._presentationConsoleMessages.push(presentationMessage);
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessageAdded, presentationMessage);
}
|
@param {WebInspector.ConsoleMessage} message
@param {DebuggerAgent.Location} rawLocation
|
updateLocation
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
MIT
|
get paused()
{
return !!WebInspector.debuggerModel.debuggerPausedDetails;
}
|
@param {WebInspector.UISourceCode} uiSourceCode
@param {number} lineNumber
@return {WebInspector.UIBreakpoint|undefined}
|
paused
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
MIT
|
function didEvaluate(result, wasThrown)
{
if (returnByValue)
callback(null, wasThrown, wasThrown ? null : result);
else
callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
if (objectGroup === "console")
this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame);
}
|
@param {?RuntimeAgent.RemoteObject} result
@param {boolean} wasThrown
|
didEvaluate
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
MIT
|
function didEvaluateOnCallFrame(error, result, wasThrown)
{
if (error) {
console.error(error);
callback(null, false);
return;
}
callback(result, wasThrown);
}
|
@this {WebInspector.PresentationCallFrame}
@param {?Protocol.Error} error
@param {RuntimeAgent.RemoteObject} result
@param {boolean=} wasThrown
|
didEvaluateOnCallFrame
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
MIT
|
function callback(error)
{
if (userCallback)
userCallback(error);
if (!error)
this._presentationModel._updateBreakpointsAfterLiveEdit(uiSourceCode, oldContent || "", content);
}
|
@this {WebInspector.DebuggerPresentationModelResourceBinding}
@param {?string} error
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DebuggerPresentationModel.js
|
MIT
|
function mycallback(error, success)
{
if (!error) {
delete this._attributesMap[name];
for (var i = 0; i < this._attributes.length; ++i) {
if (this._attributes[i].name === name) {
this._attributes.splice(i, 1);
break;
}
}
}
WebInspector.domAgent._markRevision(this, callback)(error);
}
|
@param {string} name
@param {function(?Protocol.Error)=} callback
|
mycallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DOMAgent.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DOMAgent.js
|
MIT
|
function callback(nodeId, error, attributes)
{
if (error) {
console.error("Error during DOMAgent operation: " + error);
return;
}
var node = this._idToDOMNode[nodeId];
if (node) {
node._setAttributesPayload(attributes);
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified, { node: node, name: "style" });
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.StyleInvalidated, node);
}
}
|
@this {WebInspector.DOMAgent}
@param {DOMAgent.NodeId} nodeId
@param {?Protocol.Error} error
@param {Array.<string>} attributes
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DOMAgent.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DOMAgent.js
|
MIT
|
function mycallback(error, nodeIds)
{
if (error) {
console.error(error);
callback(null);
return;
}
if (nodeIds.length != 1)
return;
callback(this._idToDOMNode[nodeIds[0]]);
}
|
@param {?Protocol.Error} error
@param {Array.<number>} nodeIds
|
mycallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/DOMAgent.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/DOMAgent.js
|
MIT
|
function selectNode(candidateFocusNode)
{
if (!candidateFocusNode)
candidateFocusNode = inspectedRootDocument.body || inspectedRootDocument.documentElement;
if (!candidateFocusNode)
return;
this.selectDOMNode(candidateFocusNode);
if (this.treeOutline.selectedTreeElement)
this.treeOutline.selectedTreeElement.expand();
}
|
@this {WebInspector.ElementsPanel}
@param {WebInspector.DOMNode=} candidateFocusNode
|
selectNode
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ElementsPanel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ElementsPanel.js
|
MIT
|
function updateEntryShow(entry)
{
switch (entry.type) {
case "added":
entry.parent.insertBefore(entry.node, entry.nextSibling);
break;
case "changed":
entry.node.textContent = entry.newText;
break;
}
}
|
@constructor
@extends {TreeElement}
@param {boolean=} elementCloseTag
|
updateEntryShow
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ElementsTreeOutline.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ElementsTreeOutline.js
|
MIT
|
get toolbarItemLabel()
{
return this._toolbarItemLabel;
}
|
@constructor
@extends {WebInspector.Panel}
@param {string} id
@param {string} label
@param {string} iconURL
|
toolbarItemLabel
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ExtensionPanel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ExtensionPanel.js
|
MIT
|
function nextItem(itemElement, isPageScroll, forward)
{
var scrollItemsLeft = isPageScroll && this._rowsPerViewport ? this._rowsPerViewport : 1;
var candidate = itemElement;
var lastVisibleCandidate = candidate;
do {
candidate = forward ? candidate.nextSibling : candidate.previousSibling;
if (!candidate) {
if (isPageScroll)
return lastVisibleCandidate;
else
candidate = forward ? this._itemElementsContainer.firstChild : this._itemElementsContainer.lastChild;
}
if (!this._itemElementVisible(candidate))
continue;
lastVisibleCandidate = candidate;
--scrollItemsLeft;
} while (scrollItemsLeft && candidate !== this._selectedElement);
return candidate;
}
|
@param {string=} query
@param {boolean=} isGlobal
|
nextItem
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/FilteredItemSelectionDialog.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/FilteredItemSelectionDialog.js
|
MIT
|
function showJavaScriptOutlineDialog()
{
var view = viewGetter();
if (view)
WebInspector.JavaScriptOutlineDialog._show(panel, view);
}
|
@param {{chunk, index, total, id}} data
|
showJavaScriptOutlineDialog
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/FilteredItemSelectionDialog.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/FilteredItemSelectionDialog.js
|
MIT
|
function filterOutEmptyURLs(uiSourceCode)
{
return !!uiSourceCode.fileName;
}
|
@constructor
@implements {WebInspector.SelectionDialogContentProvider}
@param {WebInspector.ScriptsPanel} panel
@param {WebInspector.DebuggerPresentationModel} presentationModel
|
filterOutEmptyURLs
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/FilteredItemSelectionDialog.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/FilteredItemSelectionDialog.js
|
MIT
|
function showOpenResourceDialog()
{
WebInspector.OpenResourceDialog._show(panel, presentationModel, relativeToElement);
}
|
@param {WebInspector.ScriptsPanel} panel
@param {WebInspector.DebuggerPresentationModel} presentationModel
|
showOpenResourceDialog
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/FilteredItemSelectionDialog.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/FilteredItemSelectionDialog.js
|
MIT
|
function innerCallback(dataEntries, hasMore)
{
var entries = [];
for (var i = 0; i < dataEntries.length; ++i) {
var key = WebInspector.IndexedDBModel.idbKeyFromKey(dataEntries[i].key);
var primaryKey = WebInspector.IndexedDBModel.idbKeyFromKey(dataEntries[i].primaryKey);
var value = WebInspector.RemoteObject.fromPayload(dataEntries[i].value);
entries.push(new WebInspector.IndexedDBModel.Entry(key, primaryKey, value));
}
callback(entries, hasMore);
}
|
@param {Array.<IndexedDBAgent.DataEntry>} dataEntries
@param {boolean} hasMore
|
innerCallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/IndexedDBModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/IndexedDBModel.js
|
MIT
|
function innerCallback(error)
{
if (error) {
console.error("IndexedDBAgent error: " + error);
return;
}
}
|
@param {string} frameId
@param {function(IndexedDBAgent.SecurityOriginWithDatabaseNames)} callback
|
innerCallback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/IndexedDBModel.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/IndexedDBModel.js
|
MIT
|
function callback(entries, hasMore)
{
this.clear();
this._entries = entries;
for (var i = 0; i < entries.length; ++i) {
var data = {};
data["number"] = i + skipCount;
data["key"] = entries[i].key;
data["primaryKey"] = entries[i].primaryKey;
data["value"] = entries[i].value;
var primaryKey = JSON.stringify(this._isIndex ? entries[i].primaryKey : entries[i].key);
var valueTitle = this._objectStore.name + "[" + primaryKey + "]";
var node = new WebInspector.IDBDataGridNode(valueTitle, data);
this._dataGrid.appendChild(node);
}
this._pageBackButton.disabled = skipCount === 0;
this._pageForwardButton.disabled = !hasMore;
}
|
@param {Array.<WebInspector.IndexedDBModel.Entry>} entries
@param {boolean} hasMore
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/IndexedDBViews.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/IndexedDBViews.js
|
MIT
|
function isLogAvailable()
{
return WebInspector.ConsoleMessage && WebInspector.RemoteObject && self.console;
}
|
@param {string=} messageLevel
@param {boolean=} showConsole
|
isLogAvailable
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/inspector.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/inspector.js
|
MIT
|
get uiSourceCode()
{
return this._uiSourceCode;
}
|
@constructor
@extends {WebInspector.SourceFrame}
@param {WebInspector.ScriptsPanel} scriptsPanel
@param {WebInspector.DebuggerPresentationModel} model
@param {WebInspector.UISourceCode} uiSourceCode
|
uiSourceCode
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/JavaScriptSourceFrame.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/JavaScriptSourceFrame.js
|
MIT
|
function getDocumentCount(entry)
{
return entry.documentCount;
}
|
@param {WebInspector.TimelinePanel} timelinePanel
@param {number} sidebarWidth
@constructor
|
getDocumentCount
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/MemoryStatistics.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/MemoryStatistics.js
|
MIT
|
function callbackWrapper(error, content, contentEncoded)
{
if (error)
callback(null, false);
else
callback(content, content && contentEncoded);
}
|
@param {WebInspector.Resource} resource
@param {function(?string, boolean)} callback
|
callbackWrapper
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/NetworkManager.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/NetworkManager.js
|
MIT
|
function showObjectPopover(result, wasThrown, anchorOverride)
{
if (popover.disposed)
return;
if (wasThrown) {
this.hidePopover();
return;
}
var anchorElement = anchorOverride || element;
var popoverContentElement = null;
if (result.type !== "object") {
popoverContentElement = document.createElement("span");
popoverContentElement.className = "monospace console-formatted-" + result.type;
popoverContentElement.style.whiteSpace = "pre";
popoverContentElement.textContent = result.description;
if (result.type === "function") {
function didGetDetails(error, response)
{
if (error) {
console.error(error);
return;
}
var container = document.createElement("div");
container.style.display = "inline-block";
var title = container.createChild("div", "function-popover-title source-code");
var functionName = title.createChild("span", "function-name");
functionName.textContent = response.name || response.inferredName || response.displayName || WebInspector.UIString("(anonymous function)");
this._linkifier = WebInspector.debuggerPresentationModel.createLinkifier();
var link = this._linkifier.linkifyRawLocation(response.location, "function-location-link");
if (link)
title.appendChild(link);
container.appendChild(popoverContentElement);
popover.show(container, anchorElement);
}
DebuggerAgent.getFunctionDetails(result.objectId, didGetDetails.bind(this));
return;
}
if (result.type === "string")
popoverContentElement.textContent = "\"" + popoverContentElement.textContent + "\"";
popover.show(popoverContentElement, anchorElement);
} else {
popoverContentElement = document.createElement("div");
this._titleElement = document.createElement("div");
this._titleElement.className = "source-frame-popover-title monospace";
this._titleElement.textContent = result.description;
popoverContentElement.appendChild(this._titleElement);
var section = new WebInspector.ObjectPropertiesSection(result);
// For HTML DOM wrappers, append "#id" to title, if not empty.
if (result.description.substr(0, 4) === "HTML") {
this._sectionUpdateProperties = section.updateProperties.bind(section);
section.updateProperties = this._updateHTMLId.bind(this);
}
section.expanded = true;
section.element.addStyleClass("source-frame-popover-tree");
section.headerElement.addStyleClass("hidden");
popoverContentElement.appendChild(section.element);
const popoverWidth = 300;
const popoverHeight = 250;
popover.show(popoverContentElement, anchorElement, popoverWidth, popoverHeight);
}
}
|
@param {WebInspector.RemoteObject} result
@param {boolean} wasThrown
@param {Element=} anchorOverride
|
showObjectPopover
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ObjectPopoverHelper.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ObjectPopoverHelper.js
|
MIT
|
function callback(properties)
{
if (!properties)
return;
this.updateProperties(properties);
}
|
@constructor
@extends {WebInspector.PropertiesSection}
@param {WebInspector.RemoteObject=} object
@param {string=} title
@param {string=} subtitle
@param {string=} emptyPlaceholder
@param {boolean=} ignoreHasOwnProperty
@param {Array.<WebInspector.RemoteObjectProperty>=} extraProperties
@param {function()=} treeElementConstructor
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ObjectPropertiesSection.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ObjectPropertiesSection.js
|
MIT
|
function callback(properties)
{
this.removeChildren();
if (!properties)
return;
properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
for (var i = 0; i < properties.length; ++i) {
if (this.treeOutline.section.skipProto && properties[i].name === "__proto__")
continue;
properties[i].parentObject = this.property.value;
this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i]));
}
}
|
@constructor
@extends {TreeElement}
@param {WebInspector.RemoteObjectProperty} property
|
callback
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/ObjectPropertiesSection.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/ObjectPropertiesSection.js
|
MIT
|
get visible()
{
return this._visible;
}
|
@param {number=} preferredWidth
@param {number=} preferredHeight
|
visible
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/Popover.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/Popover.js
|
MIT
|
function doHide()
{
self._hidePopover();
delete self._hidePopoverTimer;
}
|
@constructor
@param {Element} panelElement
@param {function(Element, Event):Element|undefined} getAnchor
@param {function(Element, WebInspector.Popover):undefined} showPopover
@param {function()=} onHide
@param {boolean=} disableOnClick
|
doHide
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/Popover.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/Popover.js
|
MIT
|
function didCreateSourceMapping(sourceMapping)
{
this._updatingSourceMapping = false;
if (sourceMapping && !this._updateNeeded)
this._saveSourceMapping(sourceMapping);
else
this._updateSourceMapping();
}
|
@this {WebInspector.RawSourceCode}
@param {WebInspector.RawSourceCode.SourceMapping} sourceMapping
|
didCreateSourceMapping
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/RawSourceCode.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/RawSourceCode.js
|
MIT
|
function didRequestContent(mimeType, content)
{
/**
* @this {WebInspector.RawSourceCode}
* @param {string} formattedContent
* @param {WebInspector.FormattedSourceMapping} mapping
*/
function didFormatContent(formattedContent, mapping)
{
var contentProvider = new WebInspector.StaticContentProvider(mimeType, formattedContent)
var uiSourceCode = this._createUISourceCode("deobfuscated:" + this.url, this.url, contentProvider);
var sourceMapping = new WebInspector.RawSourceCode.FormattedSourceMapping(this, uiSourceCode, mapping);
callback(sourceMapping);
}
this._formatter.formatContent(mimeType, content, didFormatContent.bind(this));
}
|
@this {WebInspector.RawSourceCode}
@param {string} mimeType
@param {string} content
|
didRequestContent
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/RawSourceCode.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/RawSourceCode.js
|
MIT
|
function didFormatContent(formattedContent, mapping)
{
var contentProvider = new WebInspector.StaticContentProvider(mimeType, formattedContent)
var uiSourceCode = this._createUISourceCode("deobfuscated:" + this.url, this.url, contentProvider);
var sourceMapping = new WebInspector.RawSourceCode.FormattedSourceMapping(this, uiSourceCode, mapping);
callback(sourceMapping);
}
|
@this {WebInspector.RawSourceCode}
@param {string} formattedContent
@param {WebInspector.FormattedSourceMapping} mapping
|
didFormatContent
|
javascript
|
node-pinus/pinus
|
tools/pinus-admin-web/public/front/RawSourceCode.js
|
https://github.com/node-pinus/pinus/blob/master/tools/pinus-admin-web/public/front/RawSourceCode.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.