main-thread-scheduling
Advanced tools
Comparing version 4.0.0 to 4.0.1
{ | ||
"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 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26987
445
126