调度程序
将 Scheduler (调度程序)导入后再显式导出以供外部的 CommonJS Scheduler 依赖的 ESM 包装起存在。
// This module only exists as an ESM wrapper around the external CommonJS
// 这个模块只是作为外部 CommonJS Scheduler 依赖的 ESM 包装器存在。
// Scheduler dependency. Notice that we're intentionally not using named imports
// because Rollup would use dynamic dispatch for CommonJS interop named imports.
// 注意,我们故意没有使用命名导入,因为 Rollup 对于 CommonJS 的命名导入会使用动态分派。
// When we switch to ESM, we can delete this module.
// 当我们切换到 ESM 时,可以删除这个模块。
import * as Scheduler from 'scheduler';
export const scheduleCallback = Scheduler.unstable_scheduleCallback;
export const cancelCallback = Scheduler.unstable_cancelCallback;
export const shouldYield = Scheduler.unstable_shouldYield;
export const requestPaint = Scheduler.unstable_requestPaint;
export const now = Scheduler.unstable_now;
export const getCurrentPriorityLevel =
Scheduler.unstable_getCurrentPriorityLevel;
export const ImmediatePriority = Scheduler.unstable_ImmediatePriority;
export const UserBlockingPriority = Scheduler.unstable_UserBlockingPriority;
export const NormalPriority = Scheduler.unstable_NormalPriority;
export const LowPriority = Scheduler.unstable_LowPriority;
export const IdlePriority = Scheduler.unstable_IdlePriority;
export type SchedulerCallback = (isSync: boolean) => SchedulerCallback | null;
// this doesn't actually exist on the scheduler, but it *does*
// 这实际上在调度器上并不存在,但它确实存在于
// on scheduler/unstable_mock, which we'll need for internal testing
// scheduler/unstable_mock 中,我们需要它进行内部测试
export const log = Scheduler.log;
export const unstable_setDisableYieldValue =
Scheduler.unstable_setDisableYieldValue;