How to use the scheduler.unstable_shouldYield function in scheduler

To help you get started, we’ve selected a few scheduler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Ephem / react-aldrin / src / renderer / SSRRenderer.js View on Github external
typeof props.children === 'string' ||
            typeof props.children === 'number'
        );
    },
    shouldDeprioritizeSubtree(type, props) {},
    createTextInstance(
        text,
        rootContainerInstance,
        hostContext,
        internalInstanceHandle
    ) {
        return new SSRTreeNode(RAW_TEXT_TYPE, text);
    },
    scheduleDeferredCallback: ReactScheduler.unstable_scheduleCallback,
    cancelDeferredCallback: ReactScheduler.unstable_cancelCallback,
    shouldYield: ReactScheduler.unstable_shouldYield,

    scheduleTimeout: setTimeout,
    cancelTimeout: clearTimeout,

    setTimeout: setTimeout,
    clearTimeout: clearTimeout,

    noTimeout: -1,

    // Commit hooks, useful mainly for react-dom syntethic events
    prepareForCommit() {},
    resetAfterCommit() {},

    now: ReactScheduler.unstable_now,
    isPrimaryRenderer: true,
    //useSyncScheduling: true,
github shirakaba / react-nativescript / react-nativescript / src / client / HostConfig.ts View on Github external
UpdatePayload,
    ChildSet,
    TimeoutHandle,
    NoTimeout
> = {
    //https://github.com/sencha/ext-react/issues/306#issuecomment-521906095

    scheduleDeferredCallback: scheduler.unstable_scheduleCallback,
    cancelDeferredCallback: scheduler.unstable_cancelCallback,

    // @ts-ignore not in typings
    schedulePassiveEffects: scheduler.unstable_scheduleCallback,
    cancelPassiveEffects: scheduler.unstable_cancelCallback,

    // @ts-ignore not in typings
    shouldYield: scheduler.unstable_shouldYield,
    now: scheduler.unstable_now,
    getPublicInstance(instance: Instance | TextInstance): PublicInstance {
        // TODO (this was a complete guess).
        return instance;
    },
    getRootHostContext(rootContainerInstance: Container): HostContext {
        return {
            isInAParentText: false,
            isInADockLayout: false,
            isInAGridLayout: false,
            isInAnAbsoluteLayout: false,
            isInAFlexboxLayout: false,
        };
    },
    getChildHostContext(parentHostContext: HostContext, type: Type, rootContainerInstance: Container): HostContext {
        /*
github konvajs / react-konva / lib / ReactKonvaHostConfig.js View on Github external
get: function get() {
    return _scheduler.unstable_shouldYield;
  }
});