@aurelia/kernel
Advanced tools
Comparing version 0.2.0-dev.20180925 to 0.2.0-dev.20180926
const camelCaseLookup = {}; | ||
const kebabCaseLookup = {}; | ||
const PLATFORM = { | ||
// tslint:disable-next-line:no-any | ||
global: (function () { | ||
// Workers don’t have `window`, only `self` | ||
// tslint:disable-next-line:no-typeof-undefined | ||
if (typeof self !== 'undefined') { | ||
return self; | ||
} | ||
// tslint:disable-next-line:no-typeof-undefined | ||
if (typeof global !== 'undefined') { | ||
@@ -14,2 +17,3 @@ return global; | ||
// Use only as a last resort: | ||
// tslint:disable-next-line:no-function-constructor-with-string-args | ||
return new Function('return this')(); | ||
@@ -62,2 +66,3 @@ })(), | ||
}, | ||
// tslint:disable-next-line:no-any | ||
toArray(input) { | ||
@@ -74,34 +79,2 @@ // benchmark: http://jsben.ch/xjsyF | ||
return requestAnimationFrame(callback); | ||
}, | ||
createTaskFlushRequester(onFlush) { | ||
return function requestFlush() { | ||
// We dispatch a timeout with a specified delay of 0 for engines that | ||
// can reliably accommodate that request. This will usually be snapped | ||
// to a 4 millisecond delay, but once we're flushing, there's no delay | ||
// between events. | ||
const timeoutHandle = setTimeout(handleFlushTimer, 0); | ||
// However, since this timer gets frequently dropped in Firefox | ||
// workers, we enlist an interval handle that will try to fire | ||
// an event 20 times per second until it succeeds. | ||
const intervalHandle = setInterval(handleFlushTimer, 50); | ||
function handleFlushTimer() { | ||
// Whichever timer succeeds will cancel both timers and request the | ||
// flush. | ||
clearTimeout(timeoutHandle); | ||
clearInterval(intervalHandle); | ||
onFlush(); | ||
} | ||
}; | ||
}, | ||
createMicroTaskFlushRequestor(onFlush) { | ||
const observer = new MutationObserver(onFlush); | ||
const node = document.createTextNode(''); | ||
const values = Object.create(null); | ||
let val = 'a'; | ||
values.a = 'b'; | ||
values.b = 'a'; | ||
observer.observe(node, { characterData: true }); | ||
return function requestFlush() { | ||
node.data = val = values[val]; | ||
}; | ||
} | ||
@@ -108,0 +81,0 @@ }; |
@@ -10,7 +10,10 @@ (function (global, factory) { | ||
const PLATFORM = { | ||
// tslint:disable-next-line:no-any | ||
global: (function () { | ||
// Workers don’t have `window`, only `self` | ||
// tslint:disable-next-line:no-typeof-undefined | ||
if (typeof self !== 'undefined') { | ||
return self; | ||
} | ||
// tslint:disable-next-line:no-typeof-undefined | ||
if (typeof global !== 'undefined') { | ||
@@ -21,2 +24,3 @@ return global; | ||
// Use only as a last resort: | ||
// tslint:disable-next-line:no-function-constructor-with-string-args | ||
return new Function('return this')(); | ||
@@ -69,2 +73,3 @@ })(), | ||
}, | ||
// tslint:disable-next-line:no-any | ||
toArray(input) { | ||
@@ -81,34 +86,2 @@ // benchmark: http://jsben.ch/xjsyF | ||
return requestAnimationFrame(callback); | ||
}, | ||
createTaskFlushRequester(onFlush) { | ||
return function requestFlush() { | ||
// We dispatch a timeout with a specified delay of 0 for engines that | ||
// can reliably accommodate that request. This will usually be snapped | ||
// to a 4 millisecond delay, but once we're flushing, there's no delay | ||
// between events. | ||
const timeoutHandle = setTimeout(handleFlushTimer, 0); | ||
// However, since this timer gets frequently dropped in Firefox | ||
// workers, we enlist an interval handle that will try to fire | ||
// an event 20 times per second until it succeeds. | ||
const intervalHandle = setInterval(handleFlushTimer, 50); | ||
function handleFlushTimer() { | ||
// Whichever timer succeeds will cancel both timers and request the | ||
// flush. | ||
clearTimeout(timeoutHandle); | ||
clearInterval(intervalHandle); | ||
onFlush(); | ||
} | ||
}; | ||
}, | ||
createMicroTaskFlushRequestor(onFlush) { | ||
const observer = new MutationObserver(onFlush); | ||
const node = document.createTextNode(''); | ||
const values = Object.create(null); | ||
let val = 'a'; | ||
values.a = 'b'; | ||
values.b = 'a'; | ||
observer.observe(node, { characterData: true }); | ||
return function requestFlush() { | ||
node.data = val = values[val]; | ||
}; | ||
} | ||
@@ -115,0 +88,0 @@ }; |
@@ -11,5 +11,3 @@ export declare const PLATFORM: { | ||
requestAnimationFrame(callback: (time: number) => void): number; | ||
createTaskFlushRequester(onFlush: () => void): () => void; | ||
createMicroTaskFlushRequestor(onFlush: () => void): () => void; | ||
}; | ||
//# sourceMappingURL=platform.d.ts.map |
{ | ||
"name": "@aurelia/kernel", | ||
"version": "0.2.0-dev.20180925", | ||
"version": "0.2.0-dev.20180926", | ||
"main": "dist/index.umd.js", | ||
@@ -84,3 +84,3 @@ "module": "dist/index.es6.js", | ||
}, | ||
"gitHead": "57c07e8ffac77dfd6cc55529d972c55016f316e8" | ||
"gitHead": "ad6eeb42a81e32b0c67cb4ebb65a46b608bc7397" | ||
} |
const camelCaseLookup = {}; | ||
const kebabCaseLookup = {}; | ||
const fromCharCode = String.fromCharCode; | ||
export const PLATFORM = { | ||
global: (function() { | ||
// tslint:disable-next-line:no-any | ||
global: (function(): any { | ||
// Workers don’t have `window`, only `self` | ||
// tslint:disable-next-line:no-typeof-undefined | ||
if (typeof self !== 'undefined') { | ||
@@ -13,2 +13,3 @@ return self; | ||
// tslint:disable-next-line:no-typeof-undefined | ||
if (typeof global !== 'undefined') { | ||
@@ -20,2 +21,3 @@ return global; | ||
// Use only as a last resort: | ||
// tslint:disable-next-line:no-function-constructor-with-string-args | ||
return new Function('return this')(); | ||
@@ -26,3 +28,3 @@ })(), | ||
/* tslint:disable-next-line:no-empty */ | ||
noop() { }, | ||
noop(): void { }, | ||
now(): number { | ||
@@ -69,2 +71,3 @@ return performance.now(); | ||
// tslint:disable-next-line:no-any | ||
toArray<T = any>(input: ArrayLike<T>): T[] { | ||
@@ -82,41 +85,3 @@ // benchmark: http://jsben.ch/xjsyF | ||
return requestAnimationFrame(callback); | ||
}, | ||
createTaskFlushRequester(onFlush: () => void) { | ||
return function requestFlush() { | ||
// We dispatch a timeout with a specified delay of 0 for engines that | ||
// can reliably accommodate that request. This will usually be snapped | ||
// to a 4 millisecond delay, but once we're flushing, there's no delay | ||
// between events. | ||
const timeoutHandle = setTimeout(handleFlushTimer, 0); | ||
// However, since this timer gets frequently dropped in Firefox | ||
// workers, we enlist an interval handle that will try to fire | ||
// an event 20 times per second until it succeeds. | ||
const intervalHandle = setInterval(handleFlushTimer, 50); | ||
function handleFlushTimer() { | ||
// Whichever timer succeeds will cancel both timers and request the | ||
// flush. | ||
clearTimeout(timeoutHandle); | ||
clearInterval(intervalHandle); | ||
onFlush(); | ||
} | ||
}; | ||
}, | ||
createMicroTaskFlushRequestor(onFlush: () => void): () => void { | ||
const observer = new MutationObserver(onFlush); | ||
const node = document.createTextNode(''); | ||
const values = Object.create(null); | ||
let val = 'a'; | ||
values.a = 'b'; | ||
values.b = 'a'; | ||
observer.observe(node, { characterData: true }); | ||
return function requestFlush() { | ||
node.data = val = values[val]; | ||
}; | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168612
1957