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

main-thread-scheduling

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

main-thread-scheduling - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

2

package.json
{
"name": "main-thread-scheduling",
"version": "4.0.0",
"version": "4.0.1",
"description": "Consistently responsive apps while staying on the main thread",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -21,6 +21,5 @@ <br>

</a>
<a href="https://bundlephobia.com/result?p=use-local-storage-state">
<img src="https://badgen.net/bundlephobia/min/main-thread-scheduling" alt="Test Coverage" />
<a href="https://bundlephobia.com/result?p=main-thread-scheduling">
<img src="https://badgen.net/bundlephobia/min/main-thread-scheduling" alt="Minified Size" />
</a>
<!-- [![Minified Size](https://img.shields.io/npm/dm/main-thread-scheduling)](https://www.npmjs.com/package/use-local-storage-state) -->
<p>

@@ -53,3 +52,3 @@

An in-depth overview is available [here](./docs/in-depth-overview.md). These are the main things the library does to do it's magic:
- Stops task execution when user interacts with the UI. Uses `navigator.scheduling.isInputPending()` and fallbacks to [IdleDeadline](https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline).
- Stops task execution when user interacts with the UI. Uses `navigator.scheduling.isInputPending()` and fallbacks to using either [`IdleDeadline`](https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline) or [`MessageChannel`](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel).
- Global queue. Multiple tasks are executed one by one so increasing the number of tasks doesn't degrade performance linearly.

@@ -56,0 +55,0 @@ - Sorts tasks by importance. Sorts by [priority](#priorities) and gives priority to tasks requested later.

@@ -10,3 +10,3 @@ import nextTask from './nextTask';

const start = Date.now();
const deadline = start + 32;
let deadline;
callback({

@@ -17,2 +17,3 @@ start,

timeRemaining() {
deadline = deadline !== null && deadline !== void 0 ? deadline : Date.now() + 16;
return Math.max(deadline - Date.now(), 0);

@@ -19,0 +20,0 @@ },

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