UNPKG

5.2 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'use strict';(function(d,t){"object"===typeof exports&&"undefined"!==typeof module?t(exports):"function"===typeof define&&define.amd?define(["exports"],t):t(d.SchedulerMock={})})(this,function(d){function t(){return-1!==y&&null!==n&&n.length>=y||A&&B?u=!0:!1}function E(){if(m)throw Error("Already flushing work.");if(null!==f){m=!0;try{f(!1,l)||(f=null)}finally{m=!1}}}function F(){if(m)throw Error("Already flushing work.");if(null!==f){var a=f;m=!0;try{var b=!0;do b=a(!0,l);while(b);b||(f=null);return!0}finally{m=
10!1}}else return!1}function G(a,b){var c=a.next;if(c===a)e=null;else{a===e&&(e=c);var d=a.previous;d.next=c;c.previous=d}a.next=a.previous=null;c=a.callback;d=g;var h=v;g=a.priorityLevel;v=a;try{var k=a.expirationTime<=b;switch(g){case 1:var f=c(k);break;case 2:f=c(k);break;case 3:f=c(k);break;case 4:f=c(k);break;case 5:f=c(k)}}catch(J){throw J;}finally{g=d,v=h}if("function"===typeof f)if(b=a.expirationTime,a.callback=f,null===e)e=a.next=a.previous=a;else{f=null;k=e;do{if(b<=k.expirationTime){f=k;
11break}k=k.next}while(k!==e);null===f?f=e:f===e&&(e=a);b=f.previous;b.next=f.previous=a;a.next=f;a.previous=b}}function w(a){if(null!==h&&h.startTime<=a){do{var b=h,c=b.next;if(b===c)h=null;else{h=c;var d=b.previous;d.next=c;c.previous=d}b.next=b.previous=null;H(b,b.expirationTime)}while(null!==h&&h.startTime<=a)}}function C(a){x=!1;w(a);q||(null!==e?(q=!0,f=D):null!==h&&(a=h.startTime-a,p=C,r=l+a))}function D(a,b){q=!1;x&&(x=!1,p=null,r=-1);w(b);z=!0;try{if(!a)for(;null!==e&&e.expirationTime<=b;)G(e,
12b),b=l,w(b);else if(null!==e){do G(e,b),b=l,w(b);while(null!==e&&!t())}if(null!==e)return!0;if(null!==h){var c=h.startTime-b;p=C;r=l+c}return!1}finally{z=!1}}function I(a){switch(a){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1E4;default:return 5E3}}function H(a,b){if(null===e)e=a.next=a.previous=a;else{var c=null,d=e;do{if(b<d.expirationTime){c=d;break}d=d.next}while(d!==e);null===c?c=e:c===e&&(e=a);b=c.previous;b.next=c.previous=a;a.next=c;a.previous=b}}var l=0,f=null,
13p=null,r=-1,n=null,y=-1,u=!1,m=!1,B=!1,A=!1,e=null,h=null,v=null,g=3,z=!1,q=!1,x=!1;d.unstable_flushAllWithoutAsserting=F;d.unstable_flushNumberOfYields=function(a){if(m)throw Error("Already flushing work.");if(null!==f){var b=f;y=a;m=!0;try{a=!0;do a=b(!0,l);while(a&&!u);a||(f=null)}finally{y=-1,m=u=!1}}};d.unstable_flushExpired=E;d.unstable_clearYields=function(){if(null===n)return[];var a=n;n=null;return a};d.unstable_flushUntilNextPaint=function(){if(m)throw Error("Already flushing work.");if(null!==
14f){var a=f;A=!0;B=!1;m=!0;try{var b=!0;do b=a(!0,l);while(b&&!u);b||(f=null)}finally{m=u=A=!1}}};d.unstable_flushAll=function(){if(null!==n)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");F();if(null!==n)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([...])");};d.unstable_yieldValue=function(a){null===n?n=[a]:n.push(a)};d.unstable_advanceTime=
15function(a){l+=a;m||(null!==p&&r<=l&&(p(l),r=-1,p=null),E())};d.unstable_ImmediatePriority=1;d.unstable_UserBlockingPriority=2;d.unstable_NormalPriority=3;d.unstable_IdlePriority=5;d.unstable_LowPriority=4;d.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=g;g=a;try{return b()}finally{g=c}};d.unstable_next=function(a){switch(g){case 1:case 2:case 3:var b=3;break;default:b=g}var c=g;g=b;try{return a()}finally{g=c}};d.unstable_scheduleCallback=
16function(a,b,c){var d=l;if("object"===typeof c&&null!==c){var g=c.delay;g="number"===typeof g&&0<g?d+g:d;c="number"===typeof c.timeout?c.timeout:I(a)}else c=I(a),g=d;c=g+c;a={callback:b,priorityLevel:a,startTime:g,expirationTime:c,next:null,previous:null};if(g>d){c=g;if(null===h)h=a.next=a.previous=a;else{b=null;var k=h;do{if(c<k.startTime){b=k;break}k=k.next}while(k!==h);null===b?b=h:b===h&&(h=a);c=b.previous;c.next=b.previous=a;a.next=b;a.previous=c}null===e&&h===a&&(x?(p=null,r=-1):x=!0,p=C,r=
17l+(g-d))}else H(a,c),q||z||(q=!0,f=D);return a};d.unstable_cancelCallback=function(a){var b=a.next;if(null!==b){if(a===b)a===e?e=null:a===h&&(h=null);else{a===e?e=b:a===h&&(h=b);var c=a.previous;c.next=b;b.previous=c}a.next=a.previous=null}};d.unstable_wrapCallback=function(a){var b=g;return function(){var c=g;g=b;try{return a.apply(this,arguments)}finally{g=c}}};d.unstable_getCurrentPriorityLevel=function(){return g};d.unstable_shouldYield=function(){var a=l;w(a);return null!==v&&null!==e&&e.startTime<=
18a&&e.expirationTime<v.expirationTime||t()};d.unstable_requestPaint=function(){B=!0};d.unstable_continueExecution=function(){q||z||(q=!0,f=D)};d.unstable_pauseExecution=function(){};d.unstable_getFirstCallbackNode=function(){return e};d.unstable_now=function(){return l};d.unstable_forceFrameRate=function(){};Object.defineProperty(d,"__esModule",{value:!0})});