Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scheduler] Priority levels, continuations, and wrapped callbacks #13720

Merged
merged 1 commit into from
Sep 25, 2018

Commits on Sep 25, 2018

  1. [scheduler] Priority levels, continuations, and wrapped callbacks

    All of these features are based on features of React's internal
    scheduler. The eventual goal is to lift as much as possible out of the
    React internals into the Scheduler package.
    
    Includes some renaming of existing methods.
    
    - `scheduleWork` is now `scheduleCallback`
    - `cancelScheduledWork` is now `cancelCallback`
    
    
    Priority levels
    ---------------
    
    Adds the ability to schedule callbacks at different priority levels.
    The current levels are (final names TBD):
    
    - Immediate priority. Fires at the end of the outermost currently
    executing (similar to a microtask).
    - Interactive priority. Fires within a few hundred milliseconds. This
    should only be used to provide quick feedback to the user as a result
    of an interaction.
    - Normal priority. This is the default. Fires within several seconds.
    - "Maybe" priority. Only fires if there's nothing else to do. Used for
    prerendering or warming a cache.
    
    The priority is changed using `runWithPriority`:
    
    ```js
    runWithPriority(InteractivePriority, () => {
      scheduleCallback(callback);
    });
    ```
    
    
    Continuations
    -------------
    
    Adds the ability for a callback to yield without losing its place
    in the queue, by returning a continuation. The continuation will have
    the same expiration as the callback that yielded.
    
    
    Wrapped callbacks
    -----------------
    
    Adds the ability to wrap a callback so that, when it is called, it
    receives the priority of the current execution context.
    acdlite committed Sep 25, 2018
    Configuration menu
    Copy the full SHA
    a92dc96 View commit details
    Browse the repository at this point in the history