main
js 34 lines 1.55 KB
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 // This module only exists as an ESM wrapper around the external CommonJS
11 // Scheduler dependency. Notice that we're intentionally not using named imports
12 // because Rollup would use dynamic dispatch for CommonJS interop named imports.
13 // When we switch to ESM, we can delete this module.
14 import * as Scheduler from 'scheduler';
15
16 export const scheduleCallback = Scheduler.unstable_scheduleCallback;
17 export const cancelCallback = Scheduler.unstable_cancelCallback;
18 export const shouldYield = Scheduler.unstable_shouldYield;
19 export const requestPaint = Scheduler.unstable_requestPaint;
20 export const now = Scheduler.unstable_now;
21 export const getCurrentPriorityLevel =
22 Scheduler.unstable_getCurrentPriorityLevel;
23 export const ImmediatePriority = Scheduler.unstable_ImmediatePriority;
24 export const UserBlockingPriority = Scheduler.unstable_UserBlockingPriority;
25 export const NormalPriority = Scheduler.unstable_NormalPriority;
26 export const LowPriority = Scheduler.unstable_LowPriority;
27 export const IdlePriority = Scheduler.unstable_IdlePriority;
28 export type SchedulerCallback = (isSync: boolean) => SchedulerCallback | null;
29
30 // this doesn't actually exist on the scheduler, but it *does*
31 // on scheduler/unstable_mock, which we'll need for internal testing
32 export const log = Scheduler.log;
33 export const unstable_setDisableYieldValue =
34 Scheduler.unstable_setDisableYieldValue;