scheduler
Advanced tools
Comparing version 0.11.0-alpha.0 to 0.11.0
@@ -1,2 +0,2 @@ | ||
/** @license React v16.7.0-alpha.0 | ||
/** @license React v16.6.1 | ||
* scheduler-tracing.development.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v16.7.0-alpha.0 | ||
/** @license React v16.6.1 | ||
* scheduler-tracing.production.min.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v16.7.0-alpha.0 | ||
/** @license React v16.6.1 | ||
* scheduler-tracing.profiling.min.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v16.7.0-alpha.0 | ||
/** @license React v16.6.1 | ||
* scheduler.development.js | ||
@@ -44,2 +44,3 @@ * | ||
var currentDidTimeout = false; | ||
var currentPriorityLevel = NormalPriority; | ||
@@ -56,31 +57,2 @@ var currentEventStartTime = -1; | ||
var timeRemaining; | ||
if (hasNativePerformanceNow) { | ||
timeRemaining = function () { | ||
if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) { | ||
// A higher priority callback was scheduled. Yield so we can switch to | ||
// working on that. | ||
return 0; | ||
} | ||
// We assume that if we have a performance timer that the rAF callback | ||
// gets a performance timer value. Not sure if this is always true. | ||
var remaining = getFrameDeadline() - performance.now(); | ||
return remaining > 0 ? remaining : 0; | ||
}; | ||
} else { | ||
timeRemaining = function () { | ||
// Fallback to Date.now() | ||
if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) { | ||
return 0; | ||
} | ||
var remaining = getFrameDeadline() - Date.now(); | ||
return remaining > 0 ? remaining : 0; | ||
}; | ||
} | ||
var deadlineObject = { | ||
timeRemaining: timeRemaining, | ||
didTimeout: false | ||
}; | ||
function ensureHostCallbackIsScheduled() { | ||
@@ -130,3 +102,3 @@ if (isExecutingCallback) { | ||
try { | ||
continuationCallback = callback(deadlineObject); | ||
continuationCallback = callback(); | ||
} finally { | ||
@@ -191,3 +163,2 @@ currentPriorityLevel = previousPriorityLevel; | ||
isExecutingCallback = true; | ||
deadlineObject.didTimeout = true; | ||
try { | ||
@@ -213,3 +184,4 @@ do { | ||
isExecutingCallback = true; | ||
deadlineObject.didTimeout = didTimeout; | ||
var previousDidTimeout = currentDidTimeout; | ||
currentDidTimeout = didTimeout; | ||
try { | ||
@@ -236,3 +208,3 @@ if (didTimeout) { | ||
flushFirstCallback(); | ||
} while (firstCallbackNode !== null && getFrameDeadline() - exports.unstable_now() > 0); | ||
} while (firstCallbackNode !== null && !shouldYieldToHost()); | ||
} | ||
@@ -242,2 +214,3 @@ } | ||
isExecutingCallback = false; | ||
currentDidTimeout = previousDidTimeout; | ||
if (firstCallbackNode !== null) { | ||
@@ -397,2 +370,6 @@ // There's still work remaining. Request another callback. | ||
function unstable_shouldYield() { | ||
return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost()); | ||
} | ||
// The remaining code is essentially a polyfill for requestIdleCallback. It | ||
@@ -458,3 +435,3 @@ // works by scheduling a requestAnimationFrame, storing the time for the start | ||
var cancelHostCallback; | ||
var getFrameDeadline; | ||
var shouldYieldToHost; | ||
@@ -466,3 +443,3 @@ if (typeof window !== 'undefined' && window._schedMock) { | ||
cancelHostCallback = impl[1]; | ||
getFrameDeadline = impl[2]; | ||
shouldYieldToHost = impl[2]; | ||
} else if ( | ||
@@ -502,4 +479,4 @@ // If Scheduler runs in a non-DOM environment, it falls back to a naive | ||
}; | ||
getFrameDeadline = function () { | ||
return Infinity; | ||
shouldYieldToHost = function () { | ||
return false; | ||
}; | ||
@@ -535,4 +512,4 @@ exports.unstable_now = function () { | ||
getFrameDeadline = function () { | ||
return frameDeadline; | ||
shouldYieldToHost = function () { | ||
return frameDeadline <= exports.unstable_now(); | ||
}; | ||
@@ -665,3 +642,4 @@ | ||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; | ||
exports.unstable_shouldYield = unstable_shouldYield; | ||
})(); | ||
} |
@@ -1,2 +0,2 @@ | ||
/** @license React v16.7.0-alpha.0 | ||
/** @license React v16.6.1 | ||
* scheduler.production.min.js | ||
@@ -10,11 +10,13 @@ * | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var c=null,f=3,h=-1,k=-1,l=!1,m=!1,n="object"===typeof performance&&"function"===typeof performance.now,q={timeRemaining:n?function(){if(null!==c&&c.expirationTime<k)return 0;var a=p()-performance.now();return 0<a?a:0}:function(){if(null!==c&&c.expirationTime<k)return 0;var a=p()-Date.now();return 0<a?a:0},didTimeout:!1};function r(){if(!l){var a=c.expirationTime;m?t():m=!0;u(v,a)}} | ||
function w(){var a=c,b=c.next;if(c===b)c=null;else{var d=c.previous;c=d.next=b;b.previous=d}a.next=a.previous=null;d=a.callback;b=a.expirationTime;a=a.priorityLevel;var e=f,R=k;f=a;k=b;try{var g=d(q)}finally{f=e,k=R}if("function"===typeof g)if(g={callback:g,priorityLevel:a,expirationTime:b,next:null,previous:null},null===c)c=g.next=g.previous=g;else{d=null;a=c;do{if(a.expirationTime>=b){d=a;break}a=a.next}while(a!==c);null===d?d=c:d===c&&(c=g,r());b=d.previous;b.next=d.previous=g;g.next=d;g.previous= | ||
b}}function x(){if(-1===h&&null!==c&&1===c.priorityLevel){l=!0;q.didTimeout=!0;try{do w();while(null!==c&&1===c.priorityLevel)}finally{l=!1,null!==c?r():m=!1}}}function v(a){l=!0;q.didTimeout=a;try{if(a)for(;null!==c;){var b=exports.unstable_now();if(c.expirationTime<=b){do w();while(null!==c&&c.expirationTime<=b)}else break}else if(null!==c){do w();while(null!==c&&0<p()-exports.unstable_now())}}finally{l=!1,null!==c?r():m=!1,x()}} | ||
var y=Date,z="function"===typeof setTimeout?setTimeout:void 0,A="function"===typeof clearTimeout?clearTimeout:void 0,B="function"===typeof requestAnimationFrame?requestAnimationFrame:void 0,C="function"===typeof cancelAnimationFrame?cancelAnimationFrame:void 0,D,E;function F(a){D=B(function(b){A(E);a(b)});E=z(function(){C(D);a(exports.unstable_now())},100)}if(n){var G=performance;exports.unstable_now=function(){return G.now()}}else exports.unstable_now=function(){return y.now()};var u,t,p; | ||
if("undefined"!==typeof window&&window._schedMock){var H=window._schedMock;u=H[0];t=H[1];p=H[2]}else if("undefined"===typeof window||"function"!==typeof window.addEventListener){var I=null,J=-1,K=function(a,b){if(null!==I){var d=I;I=null;try{J=b,d(a)}finally{J=-1}}};u=function(a,b){-1!==J?setTimeout(u,0,a,b):(I=a,setTimeout(K,b,!0,b),setTimeout(K,1073741823,!1,1073741823))};t=function(){I=null};p=function(){return Infinity};exports.unstable_now=function(){return-1===J?0:J}}else{"undefined"!==typeof console&& | ||
("function"!==typeof B&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!==typeof C&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var L=null,M=!1,N=-1,O=!1,P=!1,Q=0,S=33,T=33;p=function(){return Q};var U="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message", | ||
function(a){if(a.source===window&&a.data===U){M=!1;a=L;var b=N;L=null;N=-1;var d=exports.unstable_now(),e=!1;if(0>=Q-d)if(-1!==b&&b<=d)e=!0;else{O||(O=!0,F(V));L=a;N=b;return}if(null!==a){P=!0;try{a(e)}finally{P=!1}}}},!1);var V=function(a){if(null!==L){F(V);var b=a-Q+T;b<T&&S<T?(8>b&&(b=8),T=b<S?S:b):S=b;Q=a+T;M||(M=!0,window.postMessage(U,"*"))}else O=!1};u=function(a,b){L=a;N=b;P||0>b?window.postMessage(U,"*"):O||(O=!0,F(V))};t=function(){L=null;M=!1;N=-1}}exports.unstable_ImmediatePriority=1; | ||
exports.unstable_UserBlockingPriority=2;exports.unstable_NormalPriority=3;exports.unstable_IdlePriority=4;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:break;default:a=3}var d=f,e=h;f=a;h=exports.unstable_now();try{return b()}finally{f=d,h=e,x()}}; | ||
exports.unstable_scheduleCallback=function(a,b){var d=-1!==h?h:exports.unstable_now();if("object"===typeof b&&null!==b&&"number"===typeof b.timeout)b=d+b.timeout;else switch(f){case 1:b=d+-1;break;case 2:b=d+250;break;case 4:b=d+1073741823;break;default:b=d+5E3}a={callback:a,priorityLevel:f,expirationTime:b,next:null,previous:null};if(null===c)c=a.next=a.previous=a,r();else{d=null;var e=c;do{if(e.expirationTime>b){d=e;break}e=e.next}while(e!==c);null===d?d=c:d===c&&(c=a,r());b=d.previous;b.next=d.previous= | ||
a;a.next=d;a.previous=b}return a};exports.unstable_cancelCallback=function(a){var b=a.next;if(null!==b){if(b===a)c=null;else{a===c&&(c=b);var d=a.previous;d.next=b;b.previous=d}a.next=a.previous=null}};exports.unstable_wrapCallback=function(a){var b=f;return function(){var d=f,e=h;f=b;h=exports.unstable_now();try{return a.apply(this,arguments)}finally{f=d,h=e,x()}}};exports.unstable_getCurrentPriorityLevel=function(){return f}; | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var d=null,f=!1,h=3,k=-1,l=-1,m=!1,n=!1;function p(){if(!m){var a=d.expirationTime;n?q():n=!0;r(t,a)}} | ||
function u(){var a=d,b=d.next;if(d===b)d=null;else{var c=d.previous;d=c.next=b;b.previous=c}a.next=a.previous=null;c=a.callback;b=a.expirationTime;a=a.priorityLevel;var e=h,Q=l;h=a;l=b;try{var g=c()}finally{h=e,l=Q}if("function"===typeof g)if(g={callback:g,priorityLevel:a,expirationTime:b,next:null,previous:null},null===d)d=g.next=g.previous=g;else{c=null;a=d;do{if(a.expirationTime>=b){c=a;break}a=a.next}while(a!==d);null===c?c=d:c===d&&(d=g,p());b=c.previous;b.next=c.previous=g;g.next=c;g.previous= | ||
b}}function v(){if(-1===k&&null!==d&&1===d.priorityLevel){m=!0;try{do u();while(null!==d&&1===d.priorityLevel)}finally{m=!1,null!==d?p():n=!1}}}function t(a){m=!0;var b=f;f=a;try{if(a)for(;null!==d;){var c=exports.unstable_now();if(d.expirationTime<=c){do u();while(null!==d&&d.expirationTime<=c)}else break}else if(null!==d){do u();while(null!==d&&!w())}}finally{m=!1,f=b,null!==d?p():n=!1,v()}} | ||
var x=Date,y="function"===typeof setTimeout?setTimeout:void 0,z="function"===typeof clearTimeout?clearTimeout:void 0,A="function"===typeof requestAnimationFrame?requestAnimationFrame:void 0,B="function"===typeof cancelAnimationFrame?cancelAnimationFrame:void 0,C,D;function E(a){C=A(function(b){z(D);a(b)});D=y(function(){B(C);a(exports.unstable_now())},100)} | ||
if("object"===typeof performance&&"function"===typeof performance.now){var F=performance;exports.unstable_now=function(){return F.now()}}else exports.unstable_now=function(){return x.now()};var r,q,w; | ||
if("undefined"!==typeof window&&window._schedMock){var G=window._schedMock;r=G[0];q=G[1];w=G[2]}else if("undefined"===typeof window||"function"!==typeof window.addEventListener){var H=null,I=-1,J=function(a,b){if(null!==H){var c=H;H=null;try{I=b,c(a)}finally{I=-1}}};r=function(a,b){-1!==I?setTimeout(r,0,a,b):(H=a,setTimeout(J,b,!0,b),setTimeout(J,1073741823,!1,1073741823))};q=function(){H=null};w=function(){return!1};exports.unstable_now=function(){return-1===I?0:I}}else{"undefined"!==typeof console&& | ||
("function"!==typeof A&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!==typeof B&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var K=null,L=!1,M=-1,N=!1,O=!1,P=0,R=33,S=33;w=function(){return P<=exports.unstable_now()};var T="__reactIdleCallback$"+Math.random().toString(36).slice(2); | ||
window.addEventListener("message",function(a){if(a.source===window&&a.data===T){L=!1;a=K;var b=M;K=null;M=-1;var c=exports.unstable_now(),e=!1;if(0>=P-c)if(-1!==b&&b<=c)e=!0;else{N||(N=!0,E(U));K=a;M=b;return}if(null!==a){O=!0;try{a(e)}finally{O=!1}}}},!1);var U=function(a){if(null!==K){E(U);var b=a-P+S;b<S&&R<S?(8>b&&(b=8),S=b<R?R:b):R=b;P=a+S;L||(L=!0,window.postMessage(T,"*"))}else N=!1};r=function(a,b){K=a;M=b;O||0>b?window.postMessage(T,"*"):N||(N=!0,E(U))};q=function(){K=null;L=!1;M=-1}} | ||
exports.unstable_ImmediatePriority=1;exports.unstable_UserBlockingPriority=2;exports.unstable_NormalPriority=3;exports.unstable_IdlePriority=4;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:break;default:a=3}var c=h,e=k;h=a;k=exports.unstable_now();try{return b()}finally{h=c,k=e,v()}}; | ||
exports.unstable_scheduleCallback=function(a,b){var c=-1!==k?k:exports.unstable_now();if("object"===typeof b&&null!==b&&"number"===typeof b.timeout)b=c+b.timeout;else switch(h){case 1:b=c+-1;break;case 2:b=c+250;break;case 4:b=c+1073741823;break;default:b=c+5E3}a={callback:a,priorityLevel:h,expirationTime:b,next:null,previous:null};if(null===d)d=a.next=a.previous=a,p();else{c=null;var e=d;do{if(e.expirationTime>b){c=e;break}e=e.next}while(e!==d);null===c?c=d:c===d&&(d=a,p());b=c.previous;b.next=c.previous= | ||
a;a.next=c;a.previous=b}return a};exports.unstable_cancelCallback=function(a){var b=a.next;if(null!==b){if(b===a)d=null;else{a===d&&(d=b);var c=a.previous;c.next=b;b.previous=c}a.next=a.previous=null}};exports.unstable_wrapCallback=function(a){var b=h;return function(){var c=h,e=k;h=b;k=exports.unstable_now();try{return a.apply(this,arguments)}finally{h=c,k=e,v()}}};exports.unstable_getCurrentPriorityLevel=function(){return h}; | ||
exports.unstable_shouldYield=function(){return!f&&(null!==d&&d.expirationTime<l||w())}; |
{ | ||
"name": "scheduler", | ||
"version": "0.11.0-alpha.0", | ||
"version": "0.11.0", | ||
"description": "Cooperative scheduler for the browser environment.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -42,2 +42,9 @@ /** | ||
function unstable_shouldYield() { | ||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( | ||
this, | ||
arguments | ||
); | ||
} | ||
function unstable_runWithPriority() { | ||
@@ -68,2 +75,3 @@ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( | ||
unstable_cancelCallback: unstable_cancelCallback, | ||
unstable_shouldYield: unstable_shouldYield, | ||
unstable_runWithPriority: unstable_runWithPriority, | ||
@@ -70,0 +78,0 @@ unstable_wrapCallback: unstable_wrapCallback, |
@@ -42,2 +42,9 @@ /** | ||
function unstable_shouldYield() { | ||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( | ||
this, | ||
arguments | ||
); | ||
} | ||
function unstable_runWithPriority() { | ||
@@ -68,2 +75,3 @@ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( | ||
unstable_cancelCallback: unstable_cancelCallback, | ||
unstable_shouldYield: unstable_shouldYield, | ||
unstable_runWithPriority: unstable_runWithPriority, | ||
@@ -70,0 +78,0 @@ unstable_wrapCallback: unstable_wrapCallback, |
@@ -42,2 +42,9 @@ /** | ||
function unstable_shouldYield() { | ||
return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( | ||
this, | ||
arguments | ||
); | ||
} | ||
function unstable_runWithPriority() { | ||
@@ -68,2 +75,3 @@ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( | ||
unstable_cancelCallback: unstable_cancelCallback, | ||
unstable_shouldYield: unstable_shouldYield, | ||
unstable_runWithPriority: unstable_runWithPriority, | ||
@@ -70,0 +78,0 @@ unstable_wrapCallback: unstable_wrapCallback, |
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
1397
58193