UNPKG

5.18 kBJavaScriptView Raw
1/** @license React v0.15.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 d=0,e=null,g=null,k=-1,l=null,n=-1,q=!1,r=!1,t=!1,u=!1;function v(){return-1!==n&&null!==l&&l.length>=n||u&&t?q=!0:!1}function w(){if(r)throw Error("Already flushing work.");if(null!==e){r=!0;try{e(!1,d)||(e=null)}finally{r=!1}}}function x(){if(r)throw Error("Already flushing work.");if(null!==e){var a=e;r=!0;try{var b=!0;do b=a(!0,d);while(b);b||(e=null);return!0}finally{r=!1}}else return!1}
11var y=null,z=null,A=null,B=3,C=!1,D=!1,E=!1;
12function F(a,b){var c=a.next;if(c===a)y=null;else{a===y&&(y=c);var f=a.previous;f.next=c;c.previous=f}a.next=a.previous=null;c=a.callback;f=B;var p=A;B=a.priorityLevel;A=a;try{var h=a.expirationTime<=b;switch(B){case 1:var m=c(h);break;case 2:m=c(h);break;case 3:m=c(h);break;case 4:m=c(h);break;case 5:m=c(h)}}catch(L){throw L;}finally{B=f,A=p}if("function"===typeof m)if(b=a.expirationTime,a.callback=m,null===y)y=a.next=a.previous=a;else{m=null;h=y;do{if(b<=h.expirationTime){m=h;break}h=h.next}while(h!==
13y);null===m?m=y:m===y&&(y=a);b=m.previous;b.next=m.previous=a;a.next=m;a.previous=b}}function G(a){if(null!==z&&z.startTime<=a){do{var b=z,c=b.next;if(b===c)z=null;else{z=c;var f=b.previous;f.next=c;c.previous=f}b.next=b.previous=null;H(b,b.expirationTime)}while(null!==z&&z.startTime<=a)}}function I(a){E=!1;G(a);D||(null!==y?(D=!0,e=J):null!==z&&(a=z.startTime-a,g=I,k=d+a))}
14function J(a,b){D=!1;E&&(E=!1,g=null,k=-1);G(b);C=!0;try{if(!a)for(;null!==y&&y.expirationTime<=b;)F(y,b),b=d,G(b);else if(null!==y){do F(y,b),b=d,G(b);while(null!==y&&!v())}if(null!==y)return!0;if(null!==z){var c=z.startTime-b;g=I;k=d+c}return!1}finally{C=!1}}function K(a){switch(a){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1E4;default:return 5E3}}
15function H(a,b){if(null===y)y=a.next=a.previous=a;else{var c=null,f=y;do{if(b<f.expirationTime){c=f;break}f=f.next}while(f!==y);null===c?c=y:c===y&&(y=a);b=c.previous;b.next=c.previous=a;a.next=c;a.previous=b}}exports.unstable_flushAllWithoutAsserting=x;exports.unstable_flushNumberOfYields=function(a){if(r)throw Error("Already flushing work.");if(null!==e){var b=e;n=a;r=!0;try{a=!0;do a=b(!0,d);while(a&&!q);a||(e=null)}finally{n=-1,r=q=!1}}};exports.unstable_flushExpired=w;
16exports.unstable_clearYields=function(){if(null===l)return[];var a=l;l=null;return a};exports.unstable_flushUntilNextPaint=function(){if(r)throw Error("Already flushing work.");if(null!==e){var a=e;u=!0;t=!1;r=!0;try{var b=!0;do b=a(!0,d);while(b&&!q);b||(e=null)}finally{r=q=u=!1}}};
17exports.unstable_flushAll=function(){if(null!==l)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");x();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){d+=a;r||(null!==g&&k<=d&&(g(d),k=-1,g=null),w())};
18exports.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=B;B=a;try{return b()}finally{B=c}};exports.unstable_next=function(a){switch(B){case 1:case 2:case 3:var b=3;break;default:b=B}var c=B;B=b;try{return a()}finally{B=c}};
19exports.unstable_scheduleCallback=function(a,b,c){var f=d;if("object"===typeof c&&null!==c){var p=c.delay;p="number"===typeof p&&0<p?f+p:f;c="number"===typeof c.timeout?c.timeout:K(a)}else c=K(a),p=f;c=p+c;a={callback:b,priorityLevel:a,startTime:p,expirationTime:c,next:null,previous:null};if(p>f){c=p;if(null===z)z=a.next=a.previous=a;else{b=null;var h=z;do{if(c<h.startTime){b=h;break}h=h.next}while(h!==z);null===b?b=z:b===z&&(z=a);c=b.previous;c.next=b.previous=a;a.next=b;a.previous=c}null===y&&z===
20a&&(E?(g=null,k=-1):E=!0,g=I,k=d+(p-f))}else H(a,c),D||C||(D=!0,e=J);return a};exports.unstable_cancelCallback=function(a){var b=a.next;if(null!==b){if(a===b)a===y?y=null:a===z&&(z=null);else{a===y?y=b:a===z&&(z=b);var c=a.previous;c.next=b;b.previous=c}a.next=a.previous=null}};exports.unstable_wrapCallback=function(a){var b=B;return function(){var c=B;B=b;try{return a.apply(this,arguments)}finally{B=c}}};exports.unstable_getCurrentPriorityLevel=function(){return B};
21exports.unstable_shouldYield=function(){var a=d;G(a);return null!==A&&null!==y&&y.startTime<=a&&y.expirationTime<A.expirationTime||v()};exports.unstable_requestPaint=function(){t=!0};exports.unstable_continueExecution=function(){D||C||(D=!0,e=J)};exports.unstable_pauseExecution=function(){};exports.unstable_getFirstCallbackNode=function(){return y};exports.unstable_now=function(){return d};exports.unstable_forceFrameRate=function(){};