scheduler 0.12.0-alpha.3 → 0.13.0

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "branch": "pull/14384",
3
- "buildNumber": "12853",
4
- "checksum": "7b1e67b",
5
- "commit": "8599a6296",
2
+ "branch": "master",
3
+ "buildNumber": "13364",
4
+ "checksum": "ae8143f",
5
+ "commit": "d1326f466",
6
6
  "environment": "ci",
7
- "reactVersion": "16.6.1-canary-8599a6296"
7
+ "reactVersion": "16.7.0-canary-d1326f466"
8
8
  }
@@ -1,4 +1,4 @@
1
- /** @license React v0.12.0-alpha.3
1
+ /** @license React v0.13.0
2
2
  * scheduler-tracing.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -39,6 +39,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
39
39
  // Trace which interactions trigger each commit.
40
40
  var enableSchedulerTracing = true;
41
41
 
42
+ // Only used in www builds.
43
+ // TODO: true? Here it might just be false.
44
+
42
45
  // Only used in www builds.
43
46
 
44
47
 
@@ -1,4 +1,4 @@
1
- /** @license React v0.12.0-alpha.3
1
+ /** @license React v0.13.0
2
2
  * scheduler-tracing.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1,4 +1,4 @@
1
- /** @license React v0.12.0-alpha.3
1
+ /** @license React v0.13.0
2
2
  * scheduler-tracing.profiling.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1,4 +1,4 @@
1
- /** @license React v0.12.0-alpha.3
1
+ /** @license React v0.13.0
2
2
  * scheduler.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -17,6 +17,8 @@ if (process.env.NODE_ENV !== "production") {
17
17
 
18
18
  Object.defineProperty(exports, '__esModule', { value: true });
19
19
 
20
+ var enableSchedulerDebugging = false;
21
+
20
22
  /* eslint-disable no-var */
21
23
 
22
24
  // TODO: Use symbols?
@@ -44,6 +46,9 @@ var IDLE_PRIORITY = maxSigned31BitInt;
44
46
  var firstCallbackNode = null;
45
47
 
46
48
  var currentDidTimeout = false;
49
+ // Pausing the scheduler is useful for debugging.
50
+ var isSchedulerPaused = false;
51
+
47
52
  var currentPriorityLevel = NormalPriority;
48
53
  var currentEventStartTime = -1;
49
54
  var currentExpirationTime = -1;
@@ -178,13 +183,20 @@ function flushImmediateWork() {
178
183
  }
179
184
 
180
185
  function flushWork(didTimeout) {
186
+ // Exit right away if we're currently paused
187
+
188
+ if (enableSchedulerDebugging && isSchedulerPaused) {
189
+ return;
190
+ }
191
+
181
192
  isExecutingCallback = true;
182
193
  var previousDidTimeout = currentDidTimeout;
183
194
  currentDidTimeout = didTimeout;
184
195
  try {
185
196
  if (didTimeout) {
186
197
  // Flush all the expired callbacks without yielding.
187
- while (firstCallbackNode !== null) {
198
+ while (firstCallbackNode !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
199
+ // TODO Wrap in feature flag
188
200
  // Read the current time. Flush all the callbacks that expire at or
189
201
  // earlier than that time. Then read the current time again and repeat.
190
202
  // This optimizes for as few performance.now calls as possible.
@@ -192,7 +204,7 @@ function flushWork(didTimeout) {
192
204
  if (firstCallbackNode.expirationTime <= currentTime) {
193
205
  do {
194
206
  flushFirstCallback();
195
- } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime);
207
+ } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused));
196
208
  continue;
197
209
  }
198
210
  break;
@@ -201,6 +213,9 @@ function flushWork(didTimeout) {
201
213
  // Keep flushing callbacks until we run out of time in the frame.
202
214
  if (firstCallbackNode !== null) {
203
215
  do {
216
+ if (enableSchedulerDebugging && isSchedulerPaused) {
217
+ break;
218
+ }
204
219
  flushFirstCallback();
205
220
  } while (firstCallbackNode !== null && !shouldYieldToHost());
206
221
  }
@@ -339,6 +354,21 @@ function unstable_scheduleCallback(callback, deprecated_options) {
339
354
  return newNode;
340
355
  }
341
356
 
357
+ function unstable_pauseExecution() {
358
+ isSchedulerPaused = true;
359
+ }
360
+
361
+ function unstable_continueExecution() {
362
+ isSchedulerPaused = false;
363
+ if (firstCallbackNode !== null) {
364
+ ensureHostCallbackIsScheduled();
365
+ }
366
+ }
367
+
368
+ function unstable_getFirstCallbackNode() {
369
+ return firstCallbackNode;
370
+ }
371
+
342
372
  function unstable_cancelCallback(callbackNode) {
343
373
  var next = callbackNode.next;
344
374
  if (next === null) {
@@ -630,5 +660,8 @@ exports.unstable_cancelCallback = unstable_cancelCallback;
630
660
  exports.unstable_wrapCallback = unstable_wrapCallback;
631
661
  exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
632
662
  exports.unstable_shouldYield = unstable_shouldYield;
663
+ exports.unstable_continueExecution = unstable_continueExecution;
664
+ exports.unstable_pauseExecution = unstable_pauseExecution;
665
+ exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
633
666
  })();
634
667
  }
@@ -1,4 +1,4 @@
1
- /** @license React v0.12.0-alpha.3
1
+ /** @license React v0.13.0
2
2
  * scheduler.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -7,15 +7,15 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
9
 
10
- 'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var d=null,f=!1,h=3,k=-1,l=-1,m=!1,n=!1;function p(){if(!m){var a=d.expirationTime;n?q():n=!0;r(t,a)}}
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
- 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()}}
10
+ 'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var c=null,f=!1,h=3,k=-1,l=-1,m=!1,n=!1;function p(){if(!m){var a=c.expirationTime;n?q():n=!0;r(t,a)}}
11
+ function u(){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=h,Q=l;h=a;l=b;try{var g=d()}finally{h=e,l=Q}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,p());b=d.previous;b.next=d.previous=g;g.next=d;g.previous=
12
+ b}}function v(){if(-1===k&&null!==c&&1===c.priorityLevel){m=!0;try{do u();while(null!==c&&1===c.priorityLevel)}finally{m=!1,null!==c?p():n=!1}}}function t(a){m=!0;var b=f;f=a;try{if(a)for(;null!==c;){var d=exports.unstable_now();if(c.expirationTime<=d){do u();while(null!==c&&c.expirationTime<=d)}else break}else if(null!==c){do u();while(null!==c&&!w())}}finally{m=!1,f=b,null!==c?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
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
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}}};
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 d=exports.unstable_now(),e=!1;if(0>=P-d)if(-1!==b&&b<=d)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
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
- 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
- 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
- exports.unstable_shouldYield=function(){return!f&&(null!==d&&d.expirationTime<l||w())};
18
+ exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var d=h,e=k;h=a;k=exports.unstable_now();try{return b()}finally{h=d,k=e,v()}};
19
+ exports.unstable_scheduleCallback=function(a,b){var d=-1!==k?k:exports.unstable_now();if("object"===typeof b&&null!==b&&"number"===typeof b.timeout)b=d+b.timeout;else switch(h){case 1:b=d+-1;break;case 2:b=d+250;break;case 5:b=d+1073741823;break;case 4:b=d+1E4;break;default:b=d+5E3}a={callback:a,priorityLevel:h,expirationTime:b,next:null,previous:null};if(null===c)c=a.next=a.previous=a,p();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,p());
20
+ 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=h;return function(){var d=h,e=k;h=b;k=exports.unstable_now();try{return a.apply(this,arguments)}finally{h=d,k=e,v()}}};exports.unstable_getCurrentPriorityLevel=function(){return h};
21
+ exports.unstable_shouldYield=function(){return!f&&(null!==c&&c.expirationTime<l||w())};exports.unstable_continueExecution=function(){null!==c&&p()};exports.unstable_pauseExecution=function(){};exports.unstable_getFirstCallbackNode=function(){return c};
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "scheduler",
3
- "version": "0.12.0-alpha.3",
3
+ "version": "0.13.0",
4
4
  "description": "Cooperative scheduler for the browser environment.",
5
5
  "main": "index.js",
6
- "repository": "facebook/react",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/facebook/react.git",
9
+ "directory": "packages/scheduler"
10
+ },
7
11
  "license": "MIT",
8
12
  "keywords": [
9
13
  "react"
@@ -68,6 +68,27 @@
68
68
  );
69
69
  }
70
70
 
71
+ function unstable_getFirstCallbackNode() {
72
+ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply(
73
+ this,
74
+ arguments
75
+ );
76
+ }
77
+
78
+ function unstable_pauseExecution() {
79
+ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_pauseExecution.apply(
80
+ this,
81
+ arguments
82
+ );
83
+ }
84
+
85
+ function unstable_continueExecution() {
86
+ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_continueExecution.apply(
87
+ this,
88
+ arguments
89
+ );
90
+ }
91
+
71
92
  return Object.freeze({
72
93
  unstable_now: unstable_now,
73
94
  unstable_scheduleCallback: unstable_scheduleCallback,
@@ -76,5 +97,8 @@
76
97
  unstable_runWithPriority: unstable_runWithPriority,
77
98
  unstable_wrapCallback: unstable_wrapCallback,
78
99
  unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
100
+ unstable_continueExecution: unstable_continueExecution,
101
+ unstable_pauseExecution: unstable_pauseExecution,
102
+ unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
79
103
  });
80
104
  });
@@ -68,6 +68,21 @@
68
68
  );
69
69
  }
70
70
 
71
+ function unstable_getFirstCallbackNode() {
72
+ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply(
73
+ this,
74
+ arguments
75
+ );
76
+ }
77
+
78
+ function unstable_pauseExecution() {
79
+ return undefined;
80
+ }
81
+
82
+ function unstable_continueExecution() {
83
+ return undefined;
84
+ }
85
+
71
86
  return Object.freeze({
72
87
  unstable_now: unstable_now,
73
88
  unstable_scheduleCallback: unstable_scheduleCallback,
@@ -76,5 +91,8 @@
76
91
  unstable_runWithPriority: unstable_runWithPriority,
77
92
  unstable_wrapCallback: unstable_wrapCallback,
78
93
  unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
94
+ unstable_continueExecution: unstable_continueExecution,
95
+ unstable_pauseExecution: unstable_pauseExecution,
96
+ unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
79
97
  });
80
98
  });
@@ -68,6 +68,21 @@
68
68
  );
69
69
  }
70
70
 
71
+ function unstable_getFirstCallbackNode() {
72
+ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply(
73
+ this,
74
+ arguments
75
+ );
76
+ }
77
+
78
+ function unstable_pauseExecution() {
79
+ return undefined;
80
+ }
81
+
82
+ function unstable_continueExecution() {
83
+ return undefined;
84
+ }
85
+
71
86
  return Object.freeze({
72
87
  unstable_now: unstable_now,
73
88
  unstable_scheduleCallback: unstable_scheduleCallback,
@@ -76,5 +91,8 @@
76
91
  unstable_runWithPriority: unstable_runWithPriority,
77
92
  unstable_wrapCallback: unstable_wrapCallback,
78
93
  unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
94
+ unstable_continueExecution: unstable_continueExecution,
95
+ unstable_pauseExecution: unstable_pauseExecution,
96
+ unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
79
97
  });
80
98
  });