Huge news!Announcing our $20M Series A led by Andreessen Horowitz.Learn more
Socket
Socket
Log inDemoInstall

scheduler

Package Overview
Dependencies
2
Maintainers
7
Versions
1443
Issues
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

scheduler

Cooperative scheduler for the browser environment.

    0.23.0latest
    GitHub
    npm

Version published
Maintainers
7
Weekly downloads
22,903,516
decreased by-6.51%

Weekly downloads

Package description

What is scheduler?

The scheduler package is a lightweight coordination module that allows for scheduling work with different priorities. It is used by React internally for its own scheduling of updates, and it can be used in other contexts to manage tasks with various levels of urgency.

What are scheduler's main functionalities?

Immediate Priority Scheduling

Schedules a task to be performed with the highest priority, effectively running it as soon as possible.

import { unstable_scheduleCallback, unstable_ImmediatePriority } from 'scheduler';

unstable_scheduleCallback(unstable_ImmediatePriority, () => {
  console.log('Run this task immediately');
});

User Blocking Priority Scheduling

Schedules a task with a priority level that is high but not as immediate, suitable for tasks that must respond to user input, like input handlers.

import { unstable_scheduleCallback, unstable_UserBlockingPriority } from 'scheduler';

unstable_scheduleCallback(unstable_UserBlockingPriority, () => {
  console.log('Run this task with user-blocking priority');
});

Normal Priority Scheduling

Schedules a task with a normal priority, which is suitable for tasks that do not need to be run immediately or in response to direct user input.

import { unstable_scheduleCallback, unstable_NormalPriority } from 'scheduler';

unstable_scheduleCallback(unstable_NormalPriority, () => {
  console.log('Run this task with normal priority');
});

Idle Priority Scheduling

Schedules a task with the lowest priority, which will run when the browser is idle, suitable for background and low priority tasks.

import { unstable_scheduleCallback, unstable_IdlePriority } from 'scheduler';

unstable_scheduleCallback(unstable_IdlePriority, () => {
  console.log('Run this task when the browser is idle');
});

Other packages similar to scheduler

Readme

Source

scheduler

This is a package for cooperative scheduling in a browser environment. It is currently used internally by React, but we plan to make it more generic.

The public API for this package is not yet finalized.

Thanks

The React team thanks Anton Podviaznikov for donating the scheduler package name.

Keywords

FAQs

Last updated on 14 Jun 2022

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install
SocketSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc