UNPKG

23.2 kBJavaScriptView Raw
1/** @license React v0.20.1
2 * scheduler.development.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';
11
12if (process.env.NODE_ENV !== "production") {
13 (function() {
14'use strict';
15
16var enableSchedulerDebugging = false;
17var enableProfiling = true;
18
19var requestHostCallback;
20var requestHostTimeout;
21var cancelHostTimeout;
22var requestPaint;
23var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
24
25if (hasPerformanceNow) {
26 var localPerformance = performance;
27
28 exports.unstable_now = function () {
29 return localPerformance.now();
30 };
31} else {
32 var localDate = Date;
33 var initialTime = localDate.now();
34
35 exports.unstable_now = function () {
36 return localDate.now() - initialTime;
37 };
38}
39
40if ( // If Scheduler runs in a non-DOM environment, it falls back to a naive
41// implementation using setTimeout.
42typeof window === 'undefined' || // Check if MessageChannel is supported, too.
43typeof MessageChannel !== 'function') {
44 // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
45 // fallback to a naive implementation.
46 var _callback = null;
47 var _timeoutID = null;
48
49 var _flushCallback = function () {
50 if (_callback !== null) {
51 try {
52 var currentTime = exports.unstable_now();
53 var hasRemainingTime = true;
54
55 _callback(hasRemainingTime, currentTime);
56
57 _callback = null;
58 } catch (e) {
59 setTimeout(_flushCallback, 0);
60 throw e;
61 }
62 }
63 };
64
65 requestHostCallback = function (cb) {
66 if (_callback !== null) {
67 // Protect against re-entrancy.
68 setTimeout(requestHostCallback, 0, cb);
69 } else {
70 _callback = cb;
71 setTimeout(_flushCallback, 0);
72 }
73 };
74
75 requestHostTimeout = function (cb, ms) {
76 _timeoutID = setTimeout(cb, ms);
77 };
78
79 cancelHostTimeout = function () {
80 clearTimeout(_timeoutID);
81 };
82
83 exports.unstable_shouldYield = function () {
84 return false;
85 };
86
87 requestPaint = exports.unstable_forceFrameRate = function () {};
88} else {
89 // Capture local references to native APIs, in case a polyfill overrides them.
90 var _setTimeout = window.setTimeout;
91 var _clearTimeout = window.clearTimeout;
92
93 if (typeof console !== 'undefined') {
94 // TODO: Scheduler no longer requires these methods to be polyfilled. But
95 // maybe we want to continue warning if they don't exist, to preserve the
96 // option to rely on it in the future?
97 var requestAnimationFrame = window.requestAnimationFrame;
98 var cancelAnimationFrame = window.cancelAnimationFrame;
99
100 if (typeof requestAnimationFrame !== 'function') {
101 // Using console['error'] to evade Babel and ESLint
102 console['error']("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills');
103 }
104
105 if (typeof cancelAnimationFrame !== 'function') {
106 // Using console['error'] to evade Babel and ESLint
107 console['error']("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills');
108 }
109 }
110
111 var isMessageLoopRunning = false;
112 var scheduledHostCallback = null;
113 var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main
114 // thread, like user events. By default, it yields multiple times per frame.
115 // It does not attempt to align with frame boundaries, since most tasks don't
116 // need to be frame aligned; for those that do, use requestAnimationFrame.
117
118 var yieldInterval = 5;
119 var deadline = 0; // TODO: Make this configurable
120
121 {
122 // `isInputPending` is not available. Since we have no way of knowing if
123 // there's pending input, always yield at the end of the frame.
124 exports.unstable_shouldYield = function () {
125 return exports.unstable_now() >= deadline;
126 }; // Since we yield every frame regardless, `requestPaint` has no effect.
127
128
129 requestPaint = function () {};
130 }
131
132 exports.unstable_forceFrameRate = function (fps) {
133 if (fps < 0 || fps > 125) {
134 // Using console['error'] to evade Babel and ESLint
135 console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported');
136 return;
137 }
138
139 if (fps > 0) {
140 yieldInterval = Math.floor(1000 / fps);
141 } else {
142 // reset the framerate
143 yieldInterval = 5;
144 }
145 };
146
147 var performWorkUntilDeadline = function () {
148 if (scheduledHostCallback !== null) {
149 var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync
150 // cycle. This means there's always time remaining at the beginning of
151 // the message event.
152
153 deadline = currentTime + yieldInterval;
154 var hasTimeRemaining = true;
155
156 try {
157 var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
158
159 if (!hasMoreWork) {
160 isMessageLoopRunning = false;
161 scheduledHostCallback = null;
162 } else {
163 // If there's more work, schedule the next message event at the end
164 // of the preceding one.
165 port.postMessage(null);
166 }
167 } catch (error) {
168 // If a scheduler task throws, exit the current browser task so the
169 // error can be observed.
170 port.postMessage(null);
171 throw error;
172 }
173 } else {
174 isMessageLoopRunning = false;
175 } // Yielding to the browser will give it a chance to paint, so we can
176 };
177
178 var channel = new MessageChannel();
179 var port = channel.port2;
180 channel.port1.onmessage = performWorkUntilDeadline;
181
182 requestHostCallback = function (callback) {
183 scheduledHostCallback = callback;
184
185 if (!isMessageLoopRunning) {
186 isMessageLoopRunning = true;
187 port.postMessage(null);
188 }
189 };
190
191 requestHostTimeout = function (callback, ms) {
192 taskTimeoutID = _setTimeout(function () {
193 callback(exports.unstable_now());
194 }, ms);
195 };
196
197 cancelHostTimeout = function () {
198 _clearTimeout(taskTimeoutID);
199
200 taskTimeoutID = -1;
201 };
202}
203
204function push(heap, node) {
205 var index = heap.length;
206 heap.push(node);
207 siftUp(heap, node, index);
208}
209function peek(heap) {
210 var first = heap[0];
211 return first === undefined ? null : first;
212}
213function pop(heap) {
214 var first = heap[0];
215
216 if (first !== undefined) {
217 var last = heap.pop();
218
219 if (last !== first) {
220 heap[0] = last;
221 siftDown(heap, last, 0);
222 }
223
224 return first;
225 } else {
226 return null;
227 }
228}
229
230function siftUp(heap, node, i) {
231 var index = i;
232
233 while (true) {
234 var parentIndex = index - 1 >>> 1;
235 var parent = heap[parentIndex];
236
237 if (parent !== undefined && compare(parent, node) > 0) {
238 // The parent is larger. Swap positions.
239 heap[parentIndex] = node;
240 heap[index] = parent;
241 index = parentIndex;
242 } else {
243 // The parent is smaller. Exit.
244 return;
245 }
246 }
247}
248
249function siftDown(heap, node, i) {
250 var index = i;
251 var length = heap.length;
252
253 while (index < length) {
254 var leftIndex = (index + 1) * 2 - 1;
255 var left = heap[leftIndex];
256 var rightIndex = leftIndex + 1;
257 var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
258
259 if (left !== undefined && compare(left, node) < 0) {
260 if (right !== undefined && compare(right, left) < 0) {
261 heap[index] = right;
262 heap[rightIndex] = node;
263 index = rightIndex;
264 } else {
265 heap[index] = left;
266 heap[leftIndex] = node;
267 index = leftIndex;
268 }
269 } else if (right !== undefined && compare(right, node) < 0) {
270 heap[index] = right;
271 heap[rightIndex] = node;
272 index = rightIndex;
273 } else {
274 // Neither child is smaller. Exit.
275 return;
276 }
277 }
278}
279
280function compare(a, b) {
281 // Compare sort index first, then task id.
282 var diff = a.sortIndex - b.sortIndex;
283 return diff !== 0 ? diff : a.id - b.id;
284}
285
286// TODO: Use symbols?
287var NoPriority = 0;
288var ImmediatePriority = 1;
289var UserBlockingPriority = 2;
290var NormalPriority = 3;
291var LowPriority = 4;
292var IdlePriority = 5;
293
294var runIdCounter = 0;
295var mainThreadIdCounter = 0;
296var profilingStateSize = 4;
297var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer
298typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer
299typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9
300;
301var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks
302
303var PRIORITY = 0;
304var CURRENT_TASK_ID = 1;
305var CURRENT_RUN_ID = 2;
306var QUEUE_SIZE = 3;
307
308{
309 profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue
310 // array might include canceled tasks.
311
312 profilingState[QUEUE_SIZE] = 0;
313 profilingState[CURRENT_TASK_ID] = 0;
314} // Bytes per element is 4
315
316
317var INITIAL_EVENT_LOG_SIZE = 131072;
318var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes
319
320var eventLogSize = 0;
321var eventLogBuffer = null;
322var eventLog = null;
323var eventLogIndex = 0;
324var TaskStartEvent = 1;
325var TaskCompleteEvent = 2;
326var TaskErrorEvent = 3;
327var TaskCancelEvent = 4;
328var TaskRunEvent = 5;
329var TaskYieldEvent = 6;
330var SchedulerSuspendEvent = 7;
331var SchedulerResumeEvent = 8;
332
333function logEvent(entries) {
334 if (eventLog !== null) {
335 var offset = eventLogIndex;
336 eventLogIndex += entries.length;
337
338 if (eventLogIndex + 1 > eventLogSize) {
339 eventLogSize *= 2;
340
341 if (eventLogSize > MAX_EVENT_LOG_SIZE) {
342 // Using console['error'] to evade Babel and ESLint
343 console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.');
344 stopLoggingProfilingEvents();
345 return;
346 }
347
348 var newEventLog = new Int32Array(eventLogSize * 4);
349 newEventLog.set(eventLog);
350 eventLogBuffer = newEventLog.buffer;
351 eventLog = newEventLog;
352 }
353
354 eventLog.set(entries, offset);
355 }
356}
357
358function startLoggingProfilingEvents() {
359 eventLogSize = INITIAL_EVENT_LOG_SIZE;
360 eventLogBuffer = new ArrayBuffer(eventLogSize * 4);
361 eventLog = new Int32Array(eventLogBuffer);
362 eventLogIndex = 0;
363}
364function stopLoggingProfilingEvents() {
365 var buffer = eventLogBuffer;
366 eventLogSize = 0;
367 eventLogBuffer = null;
368 eventLog = null;
369 eventLogIndex = 0;
370 return buffer;
371}
372function markTaskStart(task, ms) {
373 {
374 profilingState[QUEUE_SIZE]++;
375
376 if (eventLog !== null) {
377 // performance.now returns a float, representing milliseconds. When the
378 // event is logged, it's coerced to an int. Convert to microseconds to
379 // maintain extra degrees of precision.
380 logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]);
381 }
382 }
383}
384function markTaskCompleted(task, ms) {
385 {
386 profilingState[PRIORITY] = NoPriority;
387 profilingState[CURRENT_TASK_ID] = 0;
388 profilingState[QUEUE_SIZE]--;
389
390 if (eventLog !== null) {
391 logEvent([TaskCompleteEvent, ms * 1000, task.id]);
392 }
393 }
394}
395function markTaskCanceled(task, ms) {
396 {
397 profilingState[QUEUE_SIZE]--;
398
399 if (eventLog !== null) {
400 logEvent([TaskCancelEvent, ms * 1000, task.id]);
401 }
402 }
403}
404function markTaskErrored(task, ms) {
405 {
406 profilingState[PRIORITY] = NoPriority;
407 profilingState[CURRENT_TASK_ID] = 0;
408 profilingState[QUEUE_SIZE]--;
409
410 if (eventLog !== null) {
411 logEvent([TaskErrorEvent, ms * 1000, task.id]);
412 }
413 }
414}
415function markTaskRun(task, ms) {
416 {
417 runIdCounter++;
418 profilingState[PRIORITY] = task.priorityLevel;
419 profilingState[CURRENT_TASK_ID] = task.id;
420 profilingState[CURRENT_RUN_ID] = runIdCounter;
421
422 if (eventLog !== null) {
423 logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]);
424 }
425 }
426}
427function markTaskYield(task, ms) {
428 {
429 profilingState[PRIORITY] = NoPriority;
430 profilingState[CURRENT_TASK_ID] = 0;
431 profilingState[CURRENT_RUN_ID] = 0;
432
433 if (eventLog !== null) {
434 logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]);
435 }
436 }
437}
438function markSchedulerSuspended(ms) {
439 {
440 mainThreadIdCounter++;
441
442 if (eventLog !== null) {
443 logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]);
444 }
445 }
446}
447function markSchedulerUnsuspended(ms) {
448 {
449 if (eventLog !== null) {
450 logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]);
451 }
452 }
453}
454
455/* eslint-disable no-var */
456// Math.pow(2, 30) - 1
457// 0b111111111111111111111111111111
458
459var maxSigned31BitInt = 1073741823; // Times out immediately
460
461var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
462
463var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
464var NORMAL_PRIORITY_TIMEOUT = 5000;
465var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
466
467var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap
468
469var taskQueue = [];
470var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
471
472var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
473var currentTask = null;
474var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy.
475
476var isPerformingWork = false;
477var isHostCallbackScheduled = false;
478var isHostTimeoutScheduled = false;
479
480function advanceTimers(currentTime) {
481 // Check for tasks that are no longer delayed and add them to the queue.
482 var timer = peek(timerQueue);
483
484 while (timer !== null) {
485 if (timer.callback === null) {
486 // Timer was cancelled.
487 pop(timerQueue);
488 } else if (timer.startTime <= currentTime) {
489 // Timer fired. Transfer to the task queue.
490 pop(timerQueue);
491 timer.sortIndex = timer.expirationTime;
492 push(taskQueue, timer);
493
494 {
495 markTaskStart(timer, currentTime);
496 timer.isQueued = true;
497 }
498 } else {
499 // Remaining timers are pending.
500 return;
501 }
502
503 timer = peek(timerQueue);
504 }
505}
506
507function handleTimeout(currentTime) {
508 isHostTimeoutScheduled = false;
509 advanceTimers(currentTime);
510
511 if (!isHostCallbackScheduled) {
512 if (peek(taskQueue) !== null) {
513 isHostCallbackScheduled = true;
514 requestHostCallback(flushWork);
515 } else {
516 var firstTimer = peek(timerQueue);
517
518 if (firstTimer !== null) {
519 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
520 }
521 }
522 }
523}
524
525function flushWork(hasTimeRemaining, initialTime) {
526 {
527 markSchedulerUnsuspended(initialTime);
528 } // We'll need a host callback the next time work is scheduled.
529
530
531 isHostCallbackScheduled = false;
532
533 if (isHostTimeoutScheduled) {
534 // We scheduled a timeout but it's no longer needed. Cancel it.
535 isHostTimeoutScheduled = false;
536 cancelHostTimeout();
537 }
538
539 isPerformingWork = true;
540 var previousPriorityLevel = currentPriorityLevel;
541
542 try {
543 if (enableProfiling) {
544 try {
545 return workLoop(hasTimeRemaining, initialTime);
546 } catch (error) {
547 if (currentTask !== null) {
548 var currentTime = exports.unstable_now();
549 markTaskErrored(currentTask, currentTime);
550 currentTask.isQueued = false;
551 }
552
553 throw error;
554 }
555 } else {
556 // No catch in prod code path.
557 return workLoop(hasTimeRemaining, initialTime);
558 }
559 } finally {
560 currentTask = null;
561 currentPriorityLevel = previousPriorityLevel;
562 isPerformingWork = false;
563
564 {
565 var _currentTime = exports.unstable_now();
566
567 markSchedulerSuspended(_currentTime);
568 }
569 }
570}
571
572function workLoop(hasTimeRemaining, initialTime) {
573 var currentTime = initialTime;
574 advanceTimers(currentTime);
575 currentTask = peek(taskQueue);
576
577 while (currentTask !== null && !(enableSchedulerDebugging )) {
578 if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || exports.unstable_shouldYield())) {
579 // This currentTask hasn't expired, and we've reached the deadline.
580 break;
581 }
582
583 var callback = currentTask.callback;
584
585 if (typeof callback === 'function') {
586 currentTask.callback = null;
587 currentPriorityLevel = currentTask.priorityLevel;
588 var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
589 markTaskRun(currentTask, currentTime);
590 var continuationCallback = callback(didUserCallbackTimeout);
591 currentTime = exports.unstable_now();
592
593 if (typeof continuationCallback === 'function') {
594 currentTask.callback = continuationCallback;
595 markTaskYield(currentTask, currentTime);
596 } else {
597 {
598 markTaskCompleted(currentTask, currentTime);
599 currentTask.isQueued = false;
600 }
601
602 if (currentTask === peek(taskQueue)) {
603 pop(taskQueue);
604 }
605 }
606
607 advanceTimers(currentTime);
608 } else {
609 pop(taskQueue);
610 }
611
612 currentTask = peek(taskQueue);
613 } // Return whether there's additional work
614
615
616 if (currentTask !== null) {
617 return true;
618 } else {
619 var firstTimer = peek(timerQueue);
620
621 if (firstTimer !== null) {
622 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
623 }
624
625 return false;
626 }
627}
628
629function unstable_runWithPriority(priorityLevel, eventHandler) {
630 switch (priorityLevel) {
631 case ImmediatePriority:
632 case UserBlockingPriority:
633 case NormalPriority:
634 case LowPriority:
635 case IdlePriority:
636 break;
637
638 default:
639 priorityLevel = NormalPriority;
640 }
641
642 var previousPriorityLevel = currentPriorityLevel;
643 currentPriorityLevel = priorityLevel;
644
645 try {
646 return eventHandler();
647 } finally {
648 currentPriorityLevel = previousPriorityLevel;
649 }
650}
651
652function unstable_next(eventHandler) {
653 var priorityLevel;
654
655 switch (currentPriorityLevel) {
656 case ImmediatePriority:
657 case UserBlockingPriority:
658 case NormalPriority:
659 // Shift down to normal priority
660 priorityLevel = NormalPriority;
661 break;
662
663 default:
664 // Anything lower than normal priority should remain at the current level.
665 priorityLevel = currentPriorityLevel;
666 break;
667 }
668
669 var previousPriorityLevel = currentPriorityLevel;
670 currentPriorityLevel = priorityLevel;
671
672 try {
673 return eventHandler();
674 } finally {
675 currentPriorityLevel = previousPriorityLevel;
676 }
677}
678
679function unstable_wrapCallback(callback) {
680 var parentPriorityLevel = currentPriorityLevel;
681 return function () {
682 // This is a fork of runWithPriority, inlined for performance.
683 var previousPriorityLevel = currentPriorityLevel;
684 currentPriorityLevel = parentPriorityLevel;
685
686 try {
687 return callback.apply(this, arguments);
688 } finally {
689 currentPriorityLevel = previousPriorityLevel;
690 }
691 };
692}
693
694function unstable_scheduleCallback(priorityLevel, callback, options) {
695 var currentTime = exports.unstable_now();
696 var startTime;
697
698 if (typeof options === 'object' && options !== null) {
699 var delay = options.delay;
700
701 if (typeof delay === 'number' && delay > 0) {
702 startTime = currentTime + delay;
703 } else {
704 startTime = currentTime;
705 }
706 } else {
707 startTime = currentTime;
708 }
709
710 var timeout;
711
712 switch (priorityLevel) {
713 case ImmediatePriority:
714 timeout = IMMEDIATE_PRIORITY_TIMEOUT;
715 break;
716
717 case UserBlockingPriority:
718 timeout = USER_BLOCKING_PRIORITY_TIMEOUT;
719 break;
720
721 case IdlePriority:
722 timeout = IDLE_PRIORITY_TIMEOUT;
723 break;
724
725 case LowPriority:
726 timeout = LOW_PRIORITY_TIMEOUT;
727 break;
728
729 case NormalPriority:
730 default:
731 timeout = NORMAL_PRIORITY_TIMEOUT;
732 break;
733 }
734
735 var expirationTime = startTime + timeout;
736 var newTask = {
737 id: taskIdCounter++,
738 callback: callback,
739 priorityLevel: priorityLevel,
740 startTime: startTime,
741 expirationTime: expirationTime,
742 sortIndex: -1
743 };
744
745 {
746 newTask.isQueued = false;
747 }
748
749 if (startTime > currentTime) {
750 // This is a delayed task.
751 newTask.sortIndex = startTime;
752 push(timerQueue, newTask);
753
754 if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
755 // All tasks are delayed, and this is the task with the earliest delay.
756 if (isHostTimeoutScheduled) {
757 // Cancel an existing timeout.
758 cancelHostTimeout();
759 } else {
760 isHostTimeoutScheduled = true;
761 } // Schedule a timeout.
762
763
764 requestHostTimeout(handleTimeout, startTime - currentTime);
765 }
766 } else {
767 newTask.sortIndex = expirationTime;
768 push(taskQueue, newTask);
769
770 {
771 markTaskStart(newTask, currentTime);
772 newTask.isQueued = true;
773 } // Schedule a host callback, if needed. If we're already performing work,
774 // wait until the next time we yield.
775
776
777 if (!isHostCallbackScheduled && !isPerformingWork) {
778 isHostCallbackScheduled = true;
779 requestHostCallback(flushWork);
780 }
781 }
782
783 return newTask;
784}
785
786function unstable_pauseExecution() {
787}
788
789function unstable_continueExecution() {
790
791 if (!isHostCallbackScheduled && !isPerformingWork) {
792 isHostCallbackScheduled = true;
793 requestHostCallback(flushWork);
794 }
795}
796
797function unstable_getFirstCallbackNode() {
798 return peek(taskQueue);
799}
800
801function unstable_cancelCallback(task) {
802 {
803 if (task.isQueued) {
804 var currentTime = exports.unstable_now();
805 markTaskCanceled(task, currentTime);
806 task.isQueued = false;
807 }
808 } // Null out the callback to indicate the task has been canceled. (Can't
809 // remove from the queue because you can't remove arbitrary nodes from an
810 // array based heap, only the first one.)
811
812
813 task.callback = null;
814}
815
816function unstable_getCurrentPriorityLevel() {
817 return currentPriorityLevel;
818}
819
820var unstable_requestPaint = requestPaint;
821var unstable_Profiling = {
822 startLoggingProfilingEvents: startLoggingProfilingEvents,
823 stopLoggingProfilingEvents: stopLoggingProfilingEvents,
824 sharedProfilingBuffer: sharedProfilingBuffer
825} ;
826
827exports.unstable_IdlePriority = IdlePriority;
828exports.unstable_ImmediatePriority = ImmediatePriority;
829exports.unstable_LowPriority = LowPriority;
830exports.unstable_NormalPriority = NormalPriority;
831exports.unstable_Profiling = unstable_Profiling;
832exports.unstable_UserBlockingPriority = UserBlockingPriority;
833exports.unstable_cancelCallback = unstable_cancelCallback;
834exports.unstable_continueExecution = unstable_continueExecution;
835exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
836exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
837exports.unstable_next = unstable_next;
838exports.unstable_pauseExecution = unstable_pauseExecution;
839exports.unstable_requestPaint = unstable_requestPaint;
840exports.unstable_runWithPriority = unstable_runWithPriority;
841exports.unstable_scheduleCallback = unstable_scheduleCallback;
842exports.unstable_wrapCallback = unstable_wrapCallback;
843 })();
844}