Gathering detailed insights and metrics for @crikey/stores-base-queue
Gathering detailed insights and metrics for @crikey/stores-base-queue
Gathering detailed insights and metrics for @crikey/stores-base-queue
Gathering detailed insights and metrics for @crikey/stores-base-queue
Mono-Repo for Svelte compatible Store packages
npm install @crikey/stores-base-queue
Typescript
Module System
Min. Node Version
Node Version
NPM Version
70.1
Supply Chain
98.2
Quality
78.6
Maintenance
100
Vulnerability
100
License
TypeScript (99.86%)
JavaScript (0.14%)
Total Downloads
2,589
Last Day
7
Last Week
7
Last Month
18
Last Year
828
11 Stars
334 Commits
1 Forks
2 Watching
5 Branches
2 Contributors
Latest Version
0.0.13
Package Id
@crikey/stores-base-queue@0.0.13
Unpacked Size
14.93 kB
Size
4.17 kB
File Count
9
NPM Version
10.5.0
Node Version
20.12.1
Publised On
10 Apr 2024
Cumulative downloads
Total Downloads
Last day
600%
7
Compared to previous day
Last week
-22.2%
7
Compared to previous week
Last month
50%
18
Compared to previous month
Last year
-9.6%
828
Compared to previous year
No dependencies detected.
Internal peer package used to ensure signals emitted from stores are executed in a reliable predictable manner even as stores and subscriptions are changed.
See @crikey/stores-base-queue for full documentation.
enqueue_store_signals
- add actions onto the queuestore_runner
- Current (global) action runnerset_store_runner
- Set current (global) action runnerget_store_runner
- Get current (global) action runnerstore_runner_hide_errors
- Swallow all error emitted by actionsstore_runner_throw_errors
- Do not handle errors emitted by actionscreate_store_runner_log_errors
- Create an action runner which logs errors emitted by actionsNote: It is important that this package be installed as a peer dependency to ensure the queue is shared between store implementations
1# pnpm 2$ pnpm add --save-peer @crikey/stores-base-queue 3 4# npm 5$ npm add --save-peer @crikey/stores-base-queue 6 7# yarn 8$ yarn add --peer @crikey/stores-base-queue
Enqueue the provided actions using a FIFO queue. If the queue is empty, the actions will begin being called immediately until the queue is exhausted. Further actions may be added during execution which will be executed once the preceding actions are exhausted.
Example:
1const action_a = () => { console.log('action a') }; 2const action_b = () => { console.log('action b') }; 3 4enqueue_store_signals([ 5 action_a, 6 action_b 7]); 8 9// > action a 10// > action b
Example with nesting:
1enqueue_store_signals([ 2 () => { console.log("action 1") }, 3 () => { 4 console.log("action 2"); 5 enqueue_store_signals([ 6 () => { console.log("action 5") }, 7 () => { console.log("action 6") } 8 ]); 9 console.log("action 3"); 10 }, 11 () => { console.log("action 4") }, 12]); 13 14// > action 1 15// > action 2 16// > action 3 17// > action 4 18// > action 5 19// > action 6
Example Exception Handling:
1const original_runner = set_store_runner(create_store_runner_log_errors(console.error)); 2try { 3 enqueue_store_signals([ 4 () => { 5 throw new Error('error 1'); 6 }, 7 () => { 8 throw new Error('error 2'); 9 }, 10 () => { 11 throw new Error('error 3'); 12 } 13 ]); 14 15 console.log('done.'); 16 17 // > Error: error 1 18 // > Error: error 2 19 // > Error: error 3 20 // > done. 21} finally { 22 set_store_runner(original_runner); 23}
No vulnerabilities found.
No security vulnerabilities found.