scheduler 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +8 -0
- package/cjs/scheduler-tracing.development.js +1 -1
- package/cjs/scheduler-tracing.production.min.js +1 -1
- package/cjs/scheduler-tracing.profiling.min.js +1 -1
- package/cjs/scheduler.development.js +29 -34
- package/cjs/scheduler.production.min.js +6 -6
- package/package.json +3 -19
package/build-info.json
ADDED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React v0.11.3
|
|
2
2
|
* scheduler.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -432,41 +432,45 @@ var requestHostCallback;
|
|
|
432
432
|
var cancelHostCallback;
|
|
433
433
|
var shouldYieldToHost;
|
|
434
434
|
|
|
435
|
-
|
|
435
|
+
var globalValue = null;
|
|
436
|
+
if (typeof window !== 'undefined') {
|
|
437
|
+
globalValue = window;
|
|
438
|
+
} else if (typeof global !== 'undefined') {
|
|
439
|
+
globalValue = global;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (globalValue && globalValue._schedMock) {
|
|
436
443
|
// Dynamic injection, only for testing purposes.
|
|
437
|
-
var
|
|
438
|
-
requestHostCallback =
|
|
439
|
-
cancelHostCallback =
|
|
440
|
-
shouldYieldToHost =
|
|
444
|
+
var globalImpl = globalValue._schedMock;
|
|
445
|
+
requestHostCallback = globalImpl[0];
|
|
446
|
+
cancelHostCallback = globalImpl[1];
|
|
447
|
+
shouldYieldToHost = globalImpl[2];
|
|
448
|
+
exports.unstable_now = globalImpl[3];
|
|
441
449
|
} else if (
|
|
442
450
|
// If Scheduler runs in a non-DOM environment, it falls back to a naive
|
|
443
451
|
// implementation using setTimeout.
|
|
444
452
|
typeof window === 'undefined' ||
|
|
445
|
-
//
|
|
446
|
-
|
|
447
|
-
|
|
453
|
+
// Check if MessageChannel is supported, too.
|
|
454
|
+
typeof MessageChannel !== 'function') {
|
|
455
|
+
// If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
|
|
456
|
+
// fallback to a naive implementation.
|
|
448
457
|
var _callback = null;
|
|
449
|
-
var
|
|
450
|
-
var _flushCallback = function (didTimeout, ms) {
|
|
458
|
+
var _flushCallback = function (didTimeout) {
|
|
451
459
|
if (_callback !== null) {
|
|
452
|
-
var cb = _callback;
|
|
453
|
-
_callback = null;
|
|
454
460
|
try {
|
|
455
|
-
|
|
456
|
-
cb(didTimeout);
|
|
461
|
+
_callback(didTimeout);
|
|
457
462
|
} finally {
|
|
458
|
-
|
|
463
|
+
_callback = null;
|
|
459
464
|
}
|
|
460
465
|
}
|
|
461
466
|
};
|
|
462
467
|
requestHostCallback = function (cb, ms) {
|
|
463
|
-
if (
|
|
468
|
+
if (_callback !== null) {
|
|
464
469
|
// Protect against re-entrancy.
|
|
465
|
-
setTimeout(requestHostCallback, 0, cb
|
|
470
|
+
setTimeout(requestHostCallback, 0, cb);
|
|
466
471
|
} else {
|
|
467
472
|
_callback = cb;
|
|
468
|
-
setTimeout(_flushCallback,
|
|
469
|
-
setTimeout(_flushCallback, maxSigned31BitInt, false, maxSigned31BitInt);
|
|
473
|
+
setTimeout(_flushCallback, 0, false);
|
|
470
474
|
}
|
|
471
475
|
};
|
|
472
476
|
cancelHostCallback = function () {
|
|
@@ -475,9 +479,6 @@ typeof window.addEventListener !== 'function') {
|
|
|
475
479
|
shouldYieldToHost = function () {
|
|
476
480
|
return false;
|
|
477
481
|
};
|
|
478
|
-
exports.unstable_now = function () {
|
|
479
|
-
return _currentTime === -1 ? 0 : _currentTime;
|
|
480
|
-
};
|
|
481
482
|
} else {
|
|
482
483
|
if (typeof console !== 'undefined') {
|
|
483
484
|
// TODO: Remove fb.me link
|
|
@@ -509,12 +510,9 @@ typeof window.addEventListener !== 'function') {
|
|
|
509
510
|
};
|
|
510
511
|
|
|
511
512
|
// We use the postMessage trick to defer idle work until after the repaint.
|
|
512
|
-
var
|
|
513
|
-
var
|
|
514
|
-
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
|
|
513
|
+
var channel = new MessageChannel();
|
|
514
|
+
var port = channel.port2;
|
|
515
|
+
channel.port1.onmessage = function (event) {
|
|
518
516
|
isMessageEventScheduled = false;
|
|
519
517
|
|
|
520
518
|
var prevScheduledCallback = scheduledHostCallback;
|
|
@@ -555,9 +553,6 @@ typeof window.addEventListener !== 'function') {
|
|
|
555
553
|
}
|
|
556
554
|
}
|
|
557
555
|
};
|
|
558
|
-
// Assumes that we have addEventListener in this environment. Might need
|
|
559
|
-
// something better for old IE.
|
|
560
|
-
window.addEventListener('message', idleTick, false);
|
|
561
556
|
|
|
562
557
|
var animationTick = function (rafTime) {
|
|
563
558
|
if (scheduledHostCallback !== null) {
|
|
@@ -597,7 +592,7 @@ typeof window.addEventListener !== 'function') {
|
|
|
597
592
|
frameDeadline = rafTime + activeFrameTime;
|
|
598
593
|
if (!isMessageEventScheduled) {
|
|
599
594
|
isMessageEventScheduled = true;
|
|
600
|
-
|
|
595
|
+
port.postMessage(undefined);
|
|
601
596
|
}
|
|
602
597
|
};
|
|
603
598
|
|
|
@@ -606,7 +601,7 @@ typeof window.addEventListener !== 'function') {
|
|
|
606
601
|
timeoutTime = absoluteTimeout;
|
|
607
602
|
if (isFlushingHostCallback || absoluteTimeout < 0) {
|
|
608
603
|
// Don't wait for the next frame. Continue working ASAP, in a new event.
|
|
609
|
-
|
|
604
|
+
port.postMessage(undefined);
|
|
610
605
|
} else if (!isAnimationFrameScheduled) {
|
|
611
606
|
// If rAF didn't already schedule one, we need to schedule a frame.
|
|
612
607
|
// TODO: If this rAF doesn't materialize because the browser throttles, we
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React v0.11.3
|
|
2
2
|
* scheduler.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
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=
|
|
12
12
|
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()}}
|
|
13
13
|
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)}
|
|
14
|
-
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;
|
|
15
|
-
if(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.
|
|
14
|
+
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,G=null;"undefined"!==typeof window?G=window:"undefined"!==typeof global&&(G=global);
|
|
15
|
+
if(G&&G._schedMock){var H=G._schedMock;r=H[0];q=H[1];w=H[2];exports.unstable_now=H[3]}else if("undefined"===typeof window||"function"!==typeof MessageChannel){var I=null,J=function(a){if(null!==I)try{I(a)}finally{I=null}};r=function(a){null!==I?setTimeout(r,0,a):(I=a,setTimeout(J,0,!1))};q=function(){I=null};w=function(){return!1}}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"),
|
|
16
|
+
"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=new MessageChannel,U=T.port2;T.port1.onmessage=function(){L=!1;var a=K,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(V));K=a;M=b;return}if(null!==a){O=!0;try{a(e)}finally{O=!1}}};
|
|
17
|
+
var V=function(a){if(null!==K){E(V);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,U.postMessage(void 0))}else N=!1};r=function(a,b){K=a;M=b;O||0>b?U.postMessage(void 0):N||(N=!0,E(V))};q=function(){K=null;L=!1;M=-1}}exports.unstable_ImmediatePriority=1;exports.unstable_UserBlockingPriority=2;exports.unstable_NormalPriority=3;exports.unstable_IdlePriority=5;exports.unstable_LowPriority=4;
|
|
18
|
+
exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=h,e=k;h=a;k=exports.unstable_now();try{return b()}finally{h=c,k=e,v()}};
|
|
19
19
|
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 5:b=c+1073741823;break;case 4:b=c+1E4;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());
|
|
20
20
|
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};
|
|
21
21
|
exports.unstable_shouldYield=function(){return!f&&(null!==d&&d.expirationTime<l||w())};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scheduler",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "Cooperative scheduler for the browser environment.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "facebook/react",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"LICENSE",
|
|
21
21
|
"README.md",
|
|
22
|
+
"build-info.json",
|
|
22
23
|
"index.js",
|
|
23
24
|
"tracing.js",
|
|
24
25
|
"tracing-profiling.js",
|
|
@@ -29,22 +30,5 @@
|
|
|
29
30
|
"transform": [
|
|
30
31
|
"loose-envify"
|
|
31
32
|
]
|
|
32
|
-
},
|
|
33
|
-
"buildInfo": {
|
|
34
|
-
"buildID": "0c756fb-f7f79fd",
|
|
35
|
-
"checksum": "d94496cd35663b7e3250c3d4a9069d8229b72b27",
|
|
36
|
-
"unstable": false,
|
|
37
|
-
"partial": false,
|
|
38
|
-
"packages": [
|
|
39
|
-
"create-subscription",
|
|
40
|
-
"jest-react",
|
|
41
|
-
"react",
|
|
42
|
-
"react-art",
|
|
43
|
-
"react-dom",
|
|
44
|
-
"react-is",
|
|
45
|
-
"react-reconciler",
|
|
46
|
-
"react-test-renderer",
|
|
47
|
-
"scheduler"
|
|
48
|
-
]
|
|
49
33
|
}
|
|
50
|
-
}
|
|
34
|
+
}
|