@gentomiyano/optimized-web-audio-player 0.1.0 → 0.2.1

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.
Files changed (47) hide show
  1. package/README.md +189 -159
  2. package/dist/config/index.d.ts +1 -1
  3. package/dist/config/index.js +1 -0
  4. package/dist/config/index.js.map +1 -1
  5. package/dist/consumer/index.d.ts +1 -1
  6. package/dist/consumer/index.js.map +1 -1
  7. package/dist/contracts/index.d.ts +2 -2
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +1 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/media-delivery/index.d.ts +1 -1
  12. package/dist/media-delivery/index.js.map +1 -1
  13. package/dist/{media-element-C9dis4aG.d.ts → media-element-DyMO-PhK.d.ts} +1 -1
  14. package/dist/{player-DE9Vqztu.d.ts → player-BxNFzRq4.d.ts} +53 -1
  15. package/dist/ports/index.d.ts +2 -2
  16. package/dist/react/index.d.ts +22 -3
  17. package/dist/react/index.js +721 -12
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/testing/index.d.ts +1 -1
  20. package/dist/testing/index.js +1 -0
  21. package/dist/testing/index.js.map +1 -1
  22. package/dist/ui/index.d.ts +18 -2
  23. package/dist/ui/index.js +148 -55
  24. package/dist/ui/index.js.map +1 -1
  25. package/dist/ui/player-tokens.css +572 -572
  26. package/dist/ui/player-views.css +713 -654
  27. package/dist/ui/styles.css +2 -2
  28. package/package.json +14 -3
  29. package/dist/consumer-smoke/node_modules/.modules.yaml +0 -30
  30. package/dist/consumer-smoke/node_modules/.package-map.json +0 -1
  31. package/dist/consumer-smoke/node_modules/.pnpm/lock.yaml +0 -57
  32. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/LICENSE +0 -21
  33. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/README.md +0 -9
  34. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +0 -414
  35. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler-unstable_mock.production.js +0 -406
  36. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +0 -150
  37. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.js +0 -140
  38. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.development.js +0 -364
  39. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.native.development.js +0 -350
  40. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.native.production.js +0 -330
  41. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.production.js +0 -340
  42. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/index.js +0 -7
  43. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/index.native.js +0 -7
  44. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/package.json +0 -27
  45. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/unstable_mock.js +0 -7
  46. package/dist/consumer-smoke/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/unstable_post_task.js +0 -7
  47. package/dist/consumer-smoke/node_modules/.pnpm-workspace-state-v1.json +0 -29
@@ -1,406 +0,0 @@
1
- /**
2
- * @license React
3
- * scheduler-unstable_mock.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
-
11
- "use strict";
12
- function push(heap, node) {
13
- var index = heap.length;
14
- heap.push(node);
15
- a: for (; 0 < index; ) {
16
- var parentIndex = (index - 1) >>> 1,
17
- parent = heap[parentIndex];
18
- if (0 < compare(parent, node))
19
- (heap[parentIndex] = node), (heap[index] = parent), (index = parentIndex);
20
- else break a;
21
- }
22
- }
23
- function peek(heap) {
24
- return 0 === heap.length ? null : heap[0];
25
- }
26
- function pop(heap) {
27
- if (0 === heap.length) return null;
28
- var first = heap[0],
29
- last = heap.pop();
30
- if (last !== first) {
31
- heap[0] = last;
32
- a: for (
33
- var index = 0, length = heap.length, halfLength = length >>> 1;
34
- index < halfLength;
35
-
36
- ) {
37
- var leftIndex = 2 * (index + 1) - 1,
38
- left = heap[leftIndex],
39
- rightIndex = leftIndex + 1,
40
- right = heap[rightIndex];
41
- if (0 > compare(left, last))
42
- rightIndex < length && 0 > compare(right, left)
43
- ? ((heap[index] = right),
44
- (heap[rightIndex] = last),
45
- (index = rightIndex))
46
- : ((heap[index] = left),
47
- (heap[leftIndex] = last),
48
- (index = leftIndex));
49
- else if (rightIndex < length && 0 > compare(right, last))
50
- (heap[index] = right), (heap[rightIndex] = last), (index = rightIndex);
51
- else break a;
52
- }
53
- }
54
- return first;
55
- }
56
- function compare(a, b) {
57
- var diff = a.sortIndex - b.sortIndex;
58
- return 0 !== diff ? diff : a.id - b.id;
59
- }
60
- var taskQueue = [],
61
- timerQueue = [],
62
- taskIdCounter = 1,
63
- currentTask = null,
64
- currentPriorityLevel = 3,
65
- isPerformingWork = !1,
66
- isHostCallbackScheduled = !1,
67
- isHostTimeoutScheduled = !1,
68
- currentMockTime = 0,
69
- scheduledCallback = null,
70
- scheduledTimeout = null,
71
- timeoutTime = -1,
72
- yieldedValues = null,
73
- expectedNumberOfYields = -1,
74
- didStop = !1,
75
- isFlushing = !1,
76
- needsPaint = !1,
77
- shouldYieldForPaint = !1,
78
- disableYieldValue = !1;
79
- function advanceTimers(currentTime) {
80
- for (var timer = peek(timerQueue); null !== timer; ) {
81
- if (null === timer.callback) pop(timerQueue);
82
- else if (timer.startTime <= currentTime)
83
- pop(timerQueue),
84
- (timer.sortIndex = timer.expirationTime),
85
- push(taskQueue, timer);
86
- else break;
87
- timer = peek(timerQueue);
88
- }
89
- }
90
- function handleTimeout(currentTime) {
91
- isHostTimeoutScheduled = !1;
92
- advanceTimers(currentTime);
93
- if (!isHostCallbackScheduled)
94
- if (null !== peek(taskQueue))
95
- (isHostCallbackScheduled = !0), (scheduledCallback = flushWork);
96
- else {
97
- var firstTimer = peek(timerQueue);
98
- null !== firstTimer &&
99
- ((currentTime = firstTimer.startTime - currentTime),
100
- (scheduledTimeout = handleTimeout),
101
- (timeoutTime = currentMockTime + currentTime));
102
- }
103
- }
104
- function flushWork(hasTimeRemaining, initialTime) {
105
- isHostCallbackScheduled = !1;
106
- isHostTimeoutScheduled &&
107
- ((isHostTimeoutScheduled = !1),
108
- (scheduledTimeout = null),
109
- (timeoutTime = -1));
110
- isPerformingWork = !0;
111
- var previousPriorityLevel = currentPriorityLevel;
112
- try {
113
- a: {
114
- advanceTimers(initialTime);
115
- for (
116
- currentTask = peek(taskQueue);
117
- null !== currentTask &&
118
- (!(currentTask.expirationTime > initialTime) ||
119
- (hasTimeRemaining && !shouldYieldToHost()));
120
-
121
- ) {
122
- var callback = currentTask.callback;
123
- if ("function" === typeof callback) {
124
- currentTask.callback = null;
125
- currentPriorityLevel = currentTask.priorityLevel;
126
- var continuationCallback = callback(
127
- currentTask.expirationTime <= initialTime
128
- );
129
- initialTime = currentMockTime;
130
- if ("function" === typeof continuationCallback) {
131
- if (
132
- ((currentTask.callback = continuationCallback),
133
- advanceTimers(initialTime),
134
- shouldYieldForPaint)
135
- ) {
136
- var JSCompiler_inline_result = (needsPaint = !0);
137
- break a;
138
- }
139
- } else
140
- currentTask === peek(taskQueue) && pop(taskQueue),
141
- advanceTimers(initialTime);
142
- } else pop(taskQueue);
143
- currentTask = peek(taskQueue);
144
- }
145
- if (null !== currentTask) JSCompiler_inline_result = !0;
146
- else {
147
- var firstTimer = peek(timerQueue);
148
- if (null !== firstTimer) {
149
- var ms = firstTimer.startTime - initialTime;
150
- scheduledTimeout = handleTimeout;
151
- timeoutTime = currentMockTime + ms;
152
- }
153
- JSCompiler_inline_result = !1;
154
- }
155
- }
156
- return JSCompiler_inline_result;
157
- } finally {
158
- (currentTask = null),
159
- (currentPriorityLevel = previousPriorityLevel),
160
- (isPerformingWork = !1);
161
- }
162
- }
163
- function shouldYieldToHost() {
164
- return (0 === expectedNumberOfYields && null === yieldedValues) ||
165
- (-1 !== expectedNumberOfYields &&
166
- null !== yieldedValues &&
167
- yieldedValues.length >= expectedNumberOfYields) ||
168
- (shouldYieldForPaint && needsPaint)
169
- ? (didStop = !0)
170
- : !1;
171
- }
172
- function unstable_flushAllWithoutAsserting() {
173
- if (isFlushing) throw Error("Already flushing work.");
174
- if (null !== scheduledCallback) {
175
- var cb = scheduledCallback;
176
- isFlushing = !0;
177
- try {
178
- var hasMoreWork = !0;
179
- do hasMoreWork = cb(!0, currentMockTime);
180
- while (hasMoreWork);
181
- hasMoreWork || (scheduledCallback = null);
182
- return !0;
183
- } finally {
184
- isFlushing = !1;
185
- }
186
- } else return !1;
187
- }
188
- exports.log = function (value) {
189
- "disabledLog" === console.log.name ||
190
- disableYieldValue ||
191
- (null === yieldedValues
192
- ? (yieldedValues = [value])
193
- : yieldedValues.push(value));
194
- };
195
- exports.reset = function () {
196
- if (isFlushing) throw Error("Cannot reset while already flushing work.");
197
- currentMockTime = 0;
198
- scheduledTimeout = scheduledCallback = null;
199
- timeoutTime = -1;
200
- yieldedValues = null;
201
- expectedNumberOfYields = -1;
202
- needsPaint = isFlushing = didStop = !1;
203
- };
204
- exports.unstable_IdlePriority = 5;
205
- exports.unstable_ImmediatePriority = 1;
206
- exports.unstable_LowPriority = 4;
207
- exports.unstable_NormalPriority = 3;
208
- exports.unstable_Profiling = null;
209
- exports.unstable_UserBlockingPriority = 2;
210
- exports.unstable_advanceTime = function (ms) {
211
- "disabledLog" === console.log.name ||
212
- disableYieldValue ||
213
- ((currentMockTime += ms),
214
- null !== scheduledTimeout &&
215
- timeoutTime <= currentMockTime &&
216
- (scheduledTimeout(currentMockTime),
217
- (timeoutTime = -1),
218
- (scheduledTimeout = null)));
219
- };
220
- exports.unstable_cancelCallback = function (task) {
221
- task.callback = null;
222
- };
223
- exports.unstable_clearLog = function () {
224
- if (null === yieldedValues) return [];
225
- var values = yieldedValues;
226
- yieldedValues = null;
227
- return values;
228
- };
229
- exports.unstable_flushAll = function () {
230
- if (null !== yieldedValues)
231
- throw Error(
232
- "Log is not empty. Assert on the log of yielded values before flushing additional work."
233
- );
234
- unstable_flushAllWithoutAsserting();
235
- if (null !== yieldedValues)
236
- throw Error(
237
- "While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])"
238
- );
239
- };
240
- exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting;
241
- exports.unstable_flushExpired = function () {
242
- if (isFlushing) throw Error("Already flushing work.");
243
- if (null !== scheduledCallback) {
244
- isFlushing = !0;
245
- try {
246
- scheduledCallback(!1, currentMockTime) || (scheduledCallback = null);
247
- } finally {
248
- isFlushing = !1;
249
- }
250
- }
251
- };
252
- exports.unstable_flushNumberOfYields = function (count) {
253
- if (isFlushing) throw Error("Already flushing work.");
254
- if (null !== scheduledCallback) {
255
- var cb = scheduledCallback;
256
- expectedNumberOfYields = count;
257
- isFlushing = !0;
258
- try {
259
- count = !0;
260
- do count = cb(!0, currentMockTime);
261
- while (count && !didStop);
262
- count || (scheduledCallback = null);
263
- } finally {
264
- (expectedNumberOfYields = -1), (isFlushing = didStop = !1);
265
- }
266
- }
267
- };
268
- exports.unstable_flushUntilNextPaint = function () {
269
- if (isFlushing) throw Error("Already flushing work.");
270
- if (null !== scheduledCallback) {
271
- var cb = scheduledCallback;
272
- shouldYieldForPaint = !0;
273
- needsPaint = !1;
274
- isFlushing = !0;
275
- try {
276
- var hasMoreWork = !0;
277
- do hasMoreWork = cb(!0, currentMockTime);
278
- while (hasMoreWork && !didStop);
279
- hasMoreWork || (scheduledCallback = null);
280
- } finally {
281
- isFlushing = didStop = shouldYieldForPaint = !1;
282
- }
283
- }
284
- return !1;
285
- };
286
- exports.unstable_forceFrameRate = function () {};
287
- exports.unstable_getCurrentPriorityLevel = function () {
288
- return currentPriorityLevel;
289
- };
290
- exports.unstable_hasPendingWork = function () {
291
- return null !== scheduledCallback;
292
- };
293
- exports.unstable_next = function (eventHandler) {
294
- switch (currentPriorityLevel) {
295
- case 1:
296
- case 2:
297
- case 3:
298
- var priorityLevel = 3;
299
- break;
300
- default:
301
- priorityLevel = currentPriorityLevel;
302
- }
303
- var previousPriorityLevel = currentPriorityLevel;
304
- currentPriorityLevel = priorityLevel;
305
- try {
306
- return eventHandler();
307
- } finally {
308
- currentPriorityLevel = previousPriorityLevel;
309
- }
310
- };
311
- exports.unstable_now = function () {
312
- return currentMockTime;
313
- };
314
- exports.unstable_requestPaint = function () {
315
- needsPaint = !0;
316
- };
317
- exports.unstable_runWithPriority = function (priorityLevel, eventHandler) {
318
- switch (priorityLevel) {
319
- case 1:
320
- case 2:
321
- case 3:
322
- case 4:
323
- case 5:
324
- break;
325
- default:
326
- priorityLevel = 3;
327
- }
328
- var previousPriorityLevel = currentPriorityLevel;
329
- currentPriorityLevel = priorityLevel;
330
- try {
331
- return eventHandler();
332
- } finally {
333
- currentPriorityLevel = previousPriorityLevel;
334
- }
335
- };
336
- exports.unstable_scheduleCallback = function (
337
- priorityLevel,
338
- callback,
339
- options
340
- ) {
341
- var currentTime = currentMockTime;
342
- "object" === typeof options && null !== options
343
- ? ((options = options.delay),
344
- (options =
345
- "number" === typeof options && 0 < options
346
- ? currentTime + options
347
- : currentTime))
348
- : (options = currentTime);
349
- switch (priorityLevel) {
350
- case 1:
351
- var timeout = -1;
352
- break;
353
- case 2:
354
- timeout = 250;
355
- break;
356
- case 5:
357
- timeout = 1073741823;
358
- break;
359
- case 4:
360
- timeout = 1e4;
361
- break;
362
- default:
363
- timeout = 5e3;
364
- }
365
- timeout = options + timeout;
366
- priorityLevel = {
367
- id: taskIdCounter++,
368
- callback: callback,
369
- priorityLevel: priorityLevel,
370
- startTime: options,
371
- expirationTime: timeout,
372
- sortIndex: -1
373
- };
374
- options > currentTime
375
- ? ((priorityLevel.sortIndex = options),
376
- push(timerQueue, priorityLevel),
377
- null === peek(taskQueue) &&
378
- priorityLevel === peek(timerQueue) &&
379
- (isHostTimeoutScheduled
380
- ? ((scheduledTimeout = null), (timeoutTime = -1))
381
- : (isHostTimeoutScheduled = !0),
382
- (scheduledTimeout = handleTimeout),
383
- (timeoutTime = currentMockTime + (options - currentTime))))
384
- : ((priorityLevel.sortIndex = timeout),
385
- push(taskQueue, priorityLevel),
386
- isHostCallbackScheduled ||
387
- isPerformingWork ||
388
- ((isHostCallbackScheduled = !0), (scheduledCallback = flushWork)));
389
- return priorityLevel;
390
- };
391
- exports.unstable_setDisableYieldValue = function (newValue) {
392
- disableYieldValue = newValue;
393
- };
394
- exports.unstable_shouldYield = shouldYieldToHost;
395
- exports.unstable_wrapCallback = function (callback) {
396
- var parentPriorityLevel = currentPriorityLevel;
397
- return function () {
398
- var previousPriorityLevel = currentPriorityLevel;
399
- currentPriorityLevel = parentPriorityLevel;
400
- try {
401
- return callback.apply(this, arguments);
402
- } finally {
403
- currentPriorityLevel = previousPriorityLevel;
404
- }
405
- };
406
- };
@@ -1,150 +0,0 @@
1
- /**
2
- * @license React
3
- * scheduler-unstable_post_task.development.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
-
11
- "use strict";
12
- "production" !== process.env.NODE_ENV &&
13
- (function () {
14
- function runTask(priorityLevel, postTaskPriority, node, callback) {
15
- deadline = getCurrentTime() + 5;
16
- try {
17
- currentPriorityLevel_DEPRECATED = priorityLevel;
18
- var result = callback(!1);
19
- if ("function" === typeof result) {
20
- var continuationOptions = { signal: node._controller.signal },
21
- nextTask = runTask.bind(
22
- null,
23
- priorityLevel,
24
- postTaskPriority,
25
- node,
26
- result
27
- );
28
- void 0 !== scheduler.yield
29
- ? scheduler
30
- .yield(continuationOptions)
31
- .then(nextTask)
32
- .catch(handleAbortError)
33
- : scheduler
34
- .postTask(nextTask, continuationOptions)
35
- .catch(handleAbortError);
36
- }
37
- } catch (error) {
38
- setTimeout(function () {
39
- throw error;
40
- });
41
- } finally {
42
- currentPriorityLevel_DEPRECATED = 3;
43
- }
44
- }
45
- function handleAbortError() {}
46
- var perf = window.performance,
47
- setTimeout = window.setTimeout,
48
- scheduler = global.scheduler,
49
- getCurrentTime = perf.now.bind(perf),
50
- deadline = 0,
51
- currentPriorityLevel_DEPRECATED = 3;
52
- exports.unstable_IdlePriority = 5;
53
- exports.unstable_ImmediatePriority = 1;
54
- exports.unstable_LowPriority = 4;
55
- exports.unstable_NormalPriority = 3;
56
- exports.unstable_Profiling = null;
57
- exports.unstable_UserBlockingPriority = 2;
58
- exports.unstable_cancelCallback = function (node) {
59
- node._controller.abort();
60
- };
61
- exports.unstable_forceFrameRate = function () {};
62
- exports.unstable_getCurrentPriorityLevel = function () {
63
- return currentPriorityLevel_DEPRECATED;
64
- };
65
- exports.unstable_next = function (callback) {
66
- switch (currentPriorityLevel_DEPRECATED) {
67
- case 1:
68
- case 2:
69
- case 3:
70
- var priorityLevel = 3;
71
- break;
72
- default:
73
- priorityLevel = currentPriorityLevel_DEPRECATED;
74
- }
75
- var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
76
- currentPriorityLevel_DEPRECATED = priorityLevel;
77
- try {
78
- return callback();
79
- } finally {
80
- currentPriorityLevel_DEPRECATED = previousPriorityLevel;
81
- }
82
- };
83
- exports.unstable_now = getCurrentTime;
84
- exports.unstable_requestPaint = function () {};
85
- exports.unstable_runWithPriority = function (priorityLevel, callback) {
86
- var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
87
- currentPriorityLevel_DEPRECATED = priorityLevel;
88
- try {
89
- return callback();
90
- } finally {
91
- currentPriorityLevel_DEPRECATED = previousPriorityLevel;
92
- }
93
- };
94
- exports.unstable_scheduleCallback = function (
95
- priorityLevel,
96
- callback,
97
- options
98
- ) {
99
- switch (priorityLevel) {
100
- case 1:
101
- case 2:
102
- var postTaskPriority = "user-blocking";
103
- break;
104
- case 4:
105
- case 3:
106
- postTaskPriority = "user-visible";
107
- break;
108
- case 5:
109
- postTaskPriority = "background";
110
- break;
111
- default:
112
- postTaskPriority = "user-visible";
113
- }
114
- var controller = new TaskController({ priority: postTaskPriority });
115
- options = {
116
- delay:
117
- "object" === typeof options && null !== options ? options.delay : 0,
118
- signal: controller.signal
119
- };
120
- controller = { _controller: controller };
121
- scheduler
122
- .postTask(
123
- runTask.bind(
124
- null,
125
- priorityLevel,
126
- postTaskPriority,
127
- controller,
128
- callback
129
- ),
130
- options
131
- )
132
- .catch(handleAbortError);
133
- return controller;
134
- };
135
- exports.unstable_shouldYield = function () {
136
- return getCurrentTime() >= deadline;
137
- };
138
- exports.unstable_wrapCallback = function (callback) {
139
- var parentPriorityLevel = currentPriorityLevel_DEPRECATED;
140
- return function () {
141
- var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
142
- currentPriorityLevel_DEPRECATED = parentPriorityLevel;
143
- try {
144
- return callback();
145
- } finally {
146
- currentPriorityLevel_DEPRECATED = previousPriorityLevel;
147
- }
148
- };
149
- };
150
- })();
@@ -1,140 +0,0 @@
1
- /**
2
- * @license React
3
- * scheduler-unstable_post_task.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
-
11
- "use strict";
12
- var perf = window.performance,
13
- setTimeout = window.setTimeout,
14
- scheduler = global.scheduler,
15
- getCurrentTime = perf.now.bind(perf),
16
- deadline = 0,
17
- currentPriorityLevel_DEPRECATED = 3;
18
- function runTask(priorityLevel, postTaskPriority, node, callback) {
19
- deadline = getCurrentTime() + 5;
20
- try {
21
- currentPriorityLevel_DEPRECATED = priorityLevel;
22
- var result = callback(!1);
23
- if ("function" === typeof result) {
24
- var continuationOptions = { signal: node._controller.signal },
25
- nextTask = runTask.bind(
26
- null,
27
- priorityLevel,
28
- postTaskPriority,
29
- node,
30
- result
31
- );
32
- void 0 !== scheduler.yield
33
- ? scheduler
34
- .yield(continuationOptions)
35
- .then(nextTask)
36
- .catch(handleAbortError)
37
- : scheduler
38
- .postTask(nextTask, continuationOptions)
39
- .catch(handleAbortError);
40
- }
41
- } catch (error) {
42
- setTimeout(function () {
43
- throw error;
44
- });
45
- } finally {
46
- currentPriorityLevel_DEPRECATED = 3;
47
- }
48
- }
49
- function handleAbortError() {}
50
- exports.unstable_IdlePriority = 5;
51
- exports.unstable_ImmediatePriority = 1;
52
- exports.unstable_LowPriority = 4;
53
- exports.unstable_NormalPriority = 3;
54
- exports.unstable_Profiling = null;
55
- exports.unstable_UserBlockingPriority = 2;
56
- exports.unstable_cancelCallback = function (node) {
57
- node._controller.abort();
58
- };
59
- exports.unstable_forceFrameRate = function () {};
60
- exports.unstable_getCurrentPriorityLevel = function () {
61
- return currentPriorityLevel_DEPRECATED;
62
- };
63
- exports.unstable_next = function (callback) {
64
- switch (currentPriorityLevel_DEPRECATED) {
65
- case 1:
66
- case 2:
67
- case 3:
68
- var priorityLevel = 3;
69
- break;
70
- default:
71
- priorityLevel = currentPriorityLevel_DEPRECATED;
72
- }
73
- var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
74
- currentPriorityLevel_DEPRECATED = priorityLevel;
75
- try {
76
- return callback();
77
- } finally {
78
- currentPriorityLevel_DEPRECATED = previousPriorityLevel;
79
- }
80
- };
81
- exports.unstable_now = getCurrentTime;
82
- exports.unstable_requestPaint = function () {};
83
- exports.unstable_runWithPriority = function (priorityLevel, callback) {
84
- var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
85
- currentPriorityLevel_DEPRECATED = priorityLevel;
86
- try {
87
- return callback();
88
- } finally {
89
- currentPriorityLevel_DEPRECATED = previousPriorityLevel;
90
- }
91
- };
92
- exports.unstable_scheduleCallback = function (
93
- priorityLevel,
94
- callback,
95
- options
96
- ) {
97
- switch (priorityLevel) {
98
- case 1:
99
- case 2:
100
- var postTaskPriority = "user-blocking";
101
- break;
102
- case 4:
103
- case 3:
104
- postTaskPriority = "user-visible";
105
- break;
106
- case 5:
107
- postTaskPriority = "background";
108
- break;
109
- default:
110
- postTaskPriority = "user-visible";
111
- }
112
- var controller = new TaskController({ priority: postTaskPriority });
113
- options = {
114
- delay: "object" === typeof options && null !== options ? options.delay : 0,
115
- signal: controller.signal
116
- };
117
- controller = { _controller: controller };
118
- scheduler
119
- .postTask(
120
- runTask.bind(null, priorityLevel, postTaskPriority, controller, callback),
121
- options
122
- )
123
- .catch(handleAbortError);
124
- return controller;
125
- };
126
- exports.unstable_shouldYield = function () {
127
- return getCurrentTime() >= deadline;
128
- };
129
- exports.unstable_wrapCallback = function (callback) {
130
- var parentPriorityLevel = currentPriorityLevel_DEPRECATED;
131
- return function () {
132
- var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
133
- currentPriorityLevel_DEPRECATED = parentPriorityLevel;
134
- try {
135
- return callback();
136
- } finally {
137
- currentPriorityLevel_DEPRECATED = previousPriorityLevel;
138
- }
139
- };
140
- };