How to use the scheduler.unstable_now 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
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,

    supportsMutation: true,
    commitUpdate(
        domElement,
        updatePayload,
        type,
        oldProps,
        newProps,
        internalInstanceHandle
    ) {},
    commitMount(domElement, type, newProps, internalInstanceHandle) {},
    commitTextUpdate(textInstance, oldText, newText) {
        textInstance.setText(newText);
    },
github shirakaba / react-nativescript / react-nativescript / src / client / HostConfig.ts View on Github external
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 {
        /*
         * Given the following, wrapped in a Page: 
github konvajs / react-konva / lib / ReactKonvaHostConfig.js View on Github external
get: function get() {
    return _scheduler.unstable_now;
  }
});