Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scheduler

Package Overview
Dependencies
Maintainers
4
Versions
1898
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scheduler

Cooperative scheduler for the browser environment.

  • 0.25.0-rc-4c58fce7-20240904
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28M
decreased by-5.21%
Maintainers
4
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 05 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc