UNPKG

4.83 kBJavaScriptView Raw
1/** @license React v0.18.0
2 * scheduler-unstable_mock.production.min.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */
9
10'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var f=0,g=null,h=null,k=-1,l=null,m=-1,n=!1,p=!1,q=!1,r=!1;function t(){return-1!==m&&null!==l&&l.length>=m||r&&q?n=!0:!1}function x(){if(p)throw Error("Already flushing work.");if(null!==g){p=!0;try{g(!1,f)||(g=null)}finally{p=!1}}}function z(){if(p)throw Error("Already flushing work.");if(null!==g){var a=g;p=!0;try{var b=!0;do b=a(!0,f);while(b);b||(g=null);return!0}finally{p=!1}}else return!1}
11function A(a,b){var c=a.length;a.push(b);a:for(;;){var d=Math.floor((c-1)/2),e=a[d];if(void 0!==e&&0<B(e,b))a[d]=b,a[c]=e,c=d;else break a}}function C(a){a=a[0];return void 0===a?null:a}function D(a){var b=a[0];if(void 0!==b){var c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length;d<e;){var u=2*(d+1)-1,v=a[u],w=u+1,y=a[w];if(void 0!==v&&0>B(v,c))void 0!==y&&0>B(y,v)?(a[d]=y,a[w]=c,d=w):(a[d]=v,a[u]=c,d=u);else if(void 0!==y&&0>B(y,c))a[d]=y,a[w]=c,d=w;else break a}}return b}return null}
12function B(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var E=[],F=[],G=1,H=null,I=3,J=!1,K=!1,L=!1;function M(a){for(var b=C(F);null!==b;){if(null===b.callback)D(F);else if(b.startTime<=a)D(F),b.sortIndex=b.expirationTime,A(E,b);else break;b=C(F)}}function N(a){L=!1;M(a);if(!K)if(null!==C(E))K=!0,g=O;else{var b=C(F);null!==b&&(a=b.startTime-a,h=N,k=f+a)}}
13function O(a,b){K=!1;L&&(L=!1,h=null,k=-1);J=!0;var c=I;try{M(b);for(H=C(E);null!==H&&(!(H.expirationTime>b)||a&&!t());){var d=H.callback;if(null!==d){H.callback=null;I=H.priorityLevel;var e=d(H.expirationTime<=b);b=f;"function"===typeof e?H.callback=e:H===C(E)&&D(E);M(b)}else D(E);H=C(E)}if(null!==H)var u=!0;else{var v=C(F);if(null!==v){var w=v.startTime-b;h=N;k=f+w}u=!1}return u}finally{H=null,I=c,J=!1}}
14function P(a){switch(a){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1E4;default:return 5E3}}exports.unstable_flushAllWithoutAsserting=z;exports.unstable_flushNumberOfYields=function(a){if(p)throw Error("Already flushing work.");if(null!==g){var b=g;m=a;p=!0;try{a=!0;do a=b(!0,f);while(a&&!n);a||(g=null)}finally{m=-1,p=n=!1}}};exports.unstable_flushExpired=x;exports.unstable_clearYields=function(){if(null===l)return[];var a=l;l=null;return a};
15exports.unstable_flushUntilNextPaint=function(){if(p)throw Error("Already flushing work.");if(null!==g){var a=g;r=!0;q=!1;p=!0;try{var b=!0;do b=a(!0,f);while(b&&!n);b||(g=null)}finally{p=n=r=!1}}};
16exports.unstable_flushAll=function(){if(null!==l)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");z();if(null!==l)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])");};exports.unstable_yieldValue=function(a){null===l?l=[a]:l.push(a)};exports.unstable_advanceTime=function(a){f+=a;p||(null!==h&&k<=f&&(h(f),k=-1,h=null),x())};
17exports.unstable_ImmediatePriority=1;exports.unstable_UserBlockingPriority=2;exports.unstable_NormalPriority=3;exports.unstable_IdlePriority=5;exports.unstable_LowPriority=4;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=I;I=a;try{return b()}finally{I=c}};exports.unstable_next=function(a){switch(I){case 1:case 2:case 3:var b=3;break;default:b=I}var c=I;I=b;try{return a()}finally{I=c}};
18exports.unstable_scheduleCallback=function(a,b,c){var d=f;if("object"===typeof c&&null!==c){var e=c.delay;e="number"===typeof e&&0<e?d+e:d;c="number"===typeof c.timeout?c.timeout:P(a)}else c=P(a),e=d;c=e+c;a={id:G++,callback:b,priorityLevel:a,startTime:e,expirationTime:c,sortIndex:-1};e>d?(a.sortIndex=e,A(F,a),null===C(E)&&a===C(F)&&(L?(h=null,k=-1):L=!0,h=N,k=f+(e-d))):(a.sortIndex=c,A(E,a),K||J||(K=!0,g=O));return a};exports.unstable_cancelCallback=function(a){a.callback=null};
19exports.unstable_wrapCallback=function(a){var b=I;return function(){var c=I;I=b;try{return a.apply(this,arguments)}finally{I=c}}};exports.unstable_getCurrentPriorityLevel=function(){return I};exports.unstable_shouldYield=function(){var a=f;M(a);var b=C(E);return b!==H&&null!==H&&null!==b&&null!==b.callback&&b.startTime<=a&&b.expirationTime<H.expirationTime||t()};exports.unstable_requestPaint=function(){q=!0};exports.unstable_continueExecution=function(){K||J||(K=!0,g=O)};
20exports.unstable_pauseExecution=function(){};exports.unstable_getFirstCallbackNode=function(){return C(E)};exports.unstable_now=function(){return f};exports.unstable_forceFrameRate=function(){};exports.unstable_Profiling=null;