main-thread-scheduling
Advanced tools
Comparing version 12.0.0 to 12.0.1
{ | ||
"name": "main-thread-scheduling", | ||
"version": "12.0.0", | ||
"version": "12.0.1", | ||
"description": "Fast and consistently responsive apps using a single function call", | ||
@@ -52,5 +52,5 @@ "license": "MIT", | ||
"index.js", | ||
"src/*.js", | ||
"index.d.ts", | ||
"src/*.d.ts" | ||
"src/**/*.js", | ||
"src/**/*.d.ts" | ||
], | ||
@@ -57,0 +57,0 @@ "devDependencies": { |
@@ -39,3 +39,3 @@ <br> | ||
- Your users' computer fans don't spin. | ||
- It can be easily integrated into your existing codebase. | ||
- It's easy to plug it into your existing codebase. | ||
@@ -96,3 +96,3 @@ A real-world showcase of searching in 10k files and getting results instantly — https://twitter.com/antoniostoilkov/status/1539576912498118656. | ||
_This is a utility function, most people don't need to use it._ The same way `queueMicrotask()` queues a `callback` to be executed in the microtask queue `queueTask()` queues the task for the next task. You learn more at [here](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide#tasks_vs._microtasks). | ||
_This is a utility function, most people don't need to use it._ The same way `queueMicrotask()` queues a `callback` to be executed in the end of the current microtask, `queueTask()` queues the task for the next task. You learn more at [here](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide#tasks_vs._microtasks). | ||
@@ -131,2 +131,6 @@ ### More complex scenarios | ||
### Web Workers | ||
Web Workers are a great fit if you have: 1) heavy algorithm (e.g. image processing), 2) heavy process (runs for a long time, big part of the app lifecycle). However, in reality, it's rare to see people using them. That's because they require significant investment of time due to the complexity that can't be avoided when working with CPU threads regardless of the programming language. This library can be used as a gateway before transitioning to Web Workers. In most cases, you would discover the doing it on the main thread is good enough. | ||
### `scheduler.postTask()` | ||
@@ -136,3 +140,3 @@ | ||
If you want the benefits of `main-thread-scheduling`, but you prefer the `postTask()` API/thinking model, then here is an implementation of `postTask()` using `yieldOrContinue()`: | ||
If you want the benefits of `main-thread-scheduling`, but you prefer the callback based `postTask()` API/thinking model, then here is an implementation of `postTask()` using `yieldOrContinue()`: | ||
```ts | ||
@@ -145,6 +149,2 @@ async function postTask(callback: () => void | Promise<void>) { | ||
### Web Workers | ||
Web Workers are a great fit if you have: 1) heavy algorithm (e.g. image processing), 2) heavy process (runs for a long time, big part of the app lifecycle). However, in reality, it's rare to see people using them. That's because they require significant investment of time due to the complexity that can't be avoided when working with CPU threads regardless of the programming language. This library can be used as a gateway before transitioning to Web Workers. In most cases, you would discover the doing it on the main thread is good enough. | ||
<!-- | ||
@@ -151,0 +151,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
31095
38
470