scheduler
Advanced tools
Comparing version 0.10.0-alpha.400d197 to 0.10.0-alpha.f47a958
@@ -1,2 +0,2 @@ | ||
/** @license React v16.6.0-alpha.400d197 | ||
/** @license React v16.6.0-alpha.f47a958 | ||
* scheduler-tracing.development.js | ||
@@ -25,3 +25,2 @@ * | ||
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers: | ||
@@ -28,0 +27,0 @@ |
@@ -1,2 +0,2 @@ | ||
/** @license React v16.6.0-alpha.400d197 | ||
/** @license React v16.6.0-alpha.f47a958 | ||
* scheduler-tracing.production.min.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v16.6.0-alpha.400d197 | ||
/** @license React v16.6.0-alpha.f47a958 | ||
* scheduler-tracing.profiling.min.js | ||
@@ -3,0 +3,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/** @license React v16.6.0-alpha.400d197 | ||
/** @license React v16.6.0-alpha.f47a958 | ||
* scheduler.development.js | ||
@@ -509,4 +509,4 @@ * | ||
var scheduledCallback = null; | ||
var isIdleScheduled = false; | ||
var scheduledHostCallback = null; | ||
var isMessageEventScheduled = false; | ||
var timeoutTime = -1; | ||
@@ -516,3 +516,3 @@ | ||
var isPerformingIdleWork = false; | ||
var isFlushingHostCallback = false; | ||
@@ -537,4 +537,9 @@ var frameDeadline = 0; | ||
isIdleScheduled = false; | ||
isMessageEventScheduled = false; | ||
var prevScheduledCallback = scheduledHostCallback; | ||
var prevTimeoutTime = timeoutTime; | ||
scheduledHostCallback = null; | ||
timeoutTime = -1; | ||
var currentTime = exports.unstable_now(); | ||
@@ -546,3 +551,3 @@ | ||
// a timeout and whether it's been exceeded. | ||
if (timeoutTime !== -1 && timeoutTime <= currentTime) { | ||
if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) { | ||
// Exceeded the timeout. Invoke the callback even though there's no | ||
@@ -559,2 +564,4 @@ // time left. | ||
// Exit without invoking the callback. | ||
scheduledHostCallback = prevScheduledCallback; | ||
timeoutTime = prevTimeoutTime; | ||
return; | ||
@@ -564,11 +571,8 @@ } | ||
timeoutTime = -1; | ||
var callback = scheduledCallback; | ||
scheduledCallback = null; | ||
if (callback !== null) { | ||
isPerformingIdleWork = true; | ||
if (prevScheduledCallback !== null) { | ||
isFlushingHostCallback = true; | ||
try { | ||
callback(didTimeout); | ||
prevScheduledCallback(didTimeout); | ||
} finally { | ||
isPerformingIdleWork = false; | ||
isFlushingHostCallback = false; | ||
} | ||
@@ -582,3 +586,18 @@ } | ||
var animationTick = function (rafTime) { | ||
isAnimationFrameScheduled = false; | ||
if (scheduledHostCallback !== null) { | ||
// Eagerly schedule the next animation callback at the beginning of the | ||
// frame. If the scheduler queue is not empty at the end of the frame, it | ||
// will continue flushing inside that callback. If the queue *is* empty, | ||
// then it will exit immediately. Posting the callback at the start of the | ||
// frame ensures it's fired within the earliest possible frame. If we | ||
// waited until the end of the frame to post the callback, we risk the | ||
// browser skipping a frame and not firing the callback until the frame | ||
// after that. | ||
requestAnimationFrameWithTimeout(animationTick); | ||
} else { | ||
// No pending work. Exit. | ||
isAnimationFrameScheduled = false; | ||
return; | ||
} | ||
var nextFrameTime = rafTime - frameDeadline + activeFrameTime; | ||
@@ -603,4 +622,4 @@ if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) { | ||
frameDeadline = rafTime + activeFrameTime; | ||
if (!isIdleScheduled) { | ||
isIdleScheduled = true; | ||
if (!isMessageEventScheduled) { | ||
isMessageEventScheduled = true; | ||
window.postMessage(messageKey, '*'); | ||
@@ -611,5 +630,5 @@ } | ||
requestHostCallback = function (callback, absoluteTimeout) { | ||
scheduledCallback = callback; | ||
scheduledHostCallback = callback; | ||
timeoutTime = absoluteTimeout; | ||
if (isPerformingIdleWork || absoluteTimeout < 0) { | ||
if (isFlushingHostCallback || absoluteTimeout < 0) { | ||
// Don't wait for the next frame. Continue working ASAP, in a new event. | ||
@@ -628,4 +647,4 @@ window.postMessage(messageKey, '*'); | ||
cancelHostCallback = function () { | ||
scheduledCallback = null; | ||
isIdleScheduled = false; | ||
scheduledHostCallback = null; | ||
isMessageEventScheduled = false; | ||
timeoutTime = -1; | ||
@@ -632,0 +651,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/** @license React v16.6.0-alpha.400d197 | ||
/** @license React v16.6.0-alpha.f47a958 | ||
* scheduler.production.min.js | ||
@@ -10,4 +10,4 @@ * | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var c=null,e=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 f=e,R=k;e=a;k=b;try{var g=d(q)}finally{e=f,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(c));b=d.previous;b.next=d.previous=g;g.next=d;g.previous= | ||
'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(c));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(c):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(c):m=!1,x()}} | ||
@@ -17,5 +17,5 @@ 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; | ||
("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;var b=exports.unstable_now();a=!1;if(0>=Q-b)if(-1!==N&&N<=b)a=!0;else{O||(O=!0,F(V));return}N=-1;b=L;L=null;if(null!==b){P=!0;try{b(a)}finally{P=!1}}}},!1);var V=function(a){O=!1;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,"*"))};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_InteractivePriority=2; | ||
exports.unstable_NormalPriority=3;exports.unstable_WheneverPriority=4;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:break;default:a=3}var d=e,f=h;e=a;h=exports.unstable_now();try{return b()}finally{e=d,h=f,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(e){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:e,expirationTime:b,next:null,previous:null};if(null===c)c=a.next=a.previous=a,r(c);else{d=null;var f=c;do{if(f.expirationTime>b){d=f;break}f=f.next}while(f!==c);null===d?d=c:d===c&&(c=a,r(c));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=e;return function(){var d=e,f=h;e=b;h=exports.unstable_now();try{return a.apply(this,arguments)}finally{e=d,h=f,x()}}};exports.unstable_getCurrentPriorityLevel=function(){return e}; | ||
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_InteractivePriority=2;exports.unstable_NormalPriority=3;exports.unstable_WheneverPriority=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(c);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(c));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}; |
{ | ||
"name": "scheduler", | ||
"version": "0.10.0-alpha.400d197", | ||
"version": "0.10.0-alpha.f47a958", | ||
"description": "Cooperative scheduler for the browser environment.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
58384
1396