@thi.ng/fibers 0.6.23 → 0.6.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +1 -12
- package/csp.d.ts +3 -0
- package/fiber.d.ts +4 -0
- package/fiber.js +4 -0
- package/ops.d.ts +8 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
<!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
|
|
3
|
-
> [!IMPORTANT]
|
|
4
|
-
> ‼️ Announcing the thi.ng user survey 2024 📋
|
|
5
|
-
>
|
|
6
|
-
> [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
|
|
7
|
-
> (open until end of February)
|
|
8
|
-
>
|
|
9
|
-
> **To achieve a better sample size, I'd highly appreciate if you could
|
|
10
|
-
> circulate the link to this survey in your own networks.**
|
|
11
|
-
>
|
|
12
|
-
> [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
|
|
13
|
-
|
|
14
3
|
# 
|
|
15
4
|
|
|
16
5
|
[](https://www.npmjs.com/package/@thi.ng/fibers)
|
|
@@ -22,7 +11,7 @@
|
|
|
22
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
23
12
|
> and anti-framework.
|
|
24
13
|
>
|
|
25
|
-
> 🚀
|
|
14
|
+
> 🚀 Please help me to work full-time on these projects by [sponsoring me on
|
|
26
15
|
> GitHub](https://github.com/sponsors/postspectacular). Thank you! ❤️
|
|
27
16
|
|
|
28
17
|
- [About](#about)
|
package/csp.d.ts
CHANGED
|
@@ -85,6 +85,9 @@ export declare class Channel<T> {
|
|
|
85
85
|
*
|
|
86
86
|
* @example
|
|
87
87
|
* ```ts
|
|
88
|
+
* import { channel, sliding } from "@thi.ng/fibers";
|
|
89
|
+
* import { ConsoleLogger } from "@thi.ng/logger";
|
|
90
|
+
*
|
|
88
91
|
* // create unbuffered channel with single value capacity
|
|
89
92
|
* const chan = channel();
|
|
90
93
|
*
|
package/fiber.d.ts
CHANGED
|
@@ -80,6 +80,8 @@ export declare class Fiber<T = any> implements IDeref<T | undefined>, IID<string
|
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* ```ts
|
|
83
|
+
* import { fiber } from "@thi.ng/fibers";
|
|
84
|
+
*
|
|
83
85
|
* fiber(function* (ctx) {
|
|
84
86
|
* console.log("main start")
|
|
85
87
|
* // create 2 child processes
|
|
@@ -204,6 +206,8 @@ export declare class Fiber<T = any> implements IDeref<T | undefined>, IID<string
|
|
|
204
206
|
*
|
|
205
207
|
* @example
|
|
206
208
|
* ```ts
|
|
209
|
+
* import { fiber } from "@thi.ng/fibers";
|
|
210
|
+
*
|
|
207
211
|
* // start with custom higher frequency handler
|
|
208
212
|
* fiber(function*() {
|
|
209
213
|
* while(true) {
|
package/fiber.js
CHANGED
|
@@ -145,6 +145,8 @@ let Fiber = class {
|
|
|
145
145
|
*
|
|
146
146
|
* @example
|
|
147
147
|
* ```ts
|
|
148
|
+
* import { fiber } from "@thi.ng/fibers";
|
|
149
|
+
*
|
|
148
150
|
* fiber(function* (ctx) {
|
|
149
151
|
* console.log("main start")
|
|
150
152
|
* // create 2 child processes
|
|
@@ -377,6 +379,8 @@ let Fiber = class {
|
|
|
377
379
|
*
|
|
378
380
|
* @example
|
|
379
381
|
* ```ts
|
|
382
|
+
* import { fiber } from "@thi.ng/fibers";
|
|
383
|
+
*
|
|
380
384
|
* // start with custom higher frequency handler
|
|
381
385
|
* fiber(function*() {
|
|
382
386
|
* while(true) {
|
package/ops.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare const sequence: (fibers: Iterable<MaybeFiber>, opts?: Partial<Fib
|
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
34
|
* ```ts
|
|
35
|
+
* import { first, untilEvent, wait } from "@thi.ng/fibers";
|
|
36
|
+
*
|
|
35
37
|
* // wait until mouse click for max 5 seconds
|
|
36
38
|
* const res = yield* first([
|
|
37
39
|
* untilEvent(window, "click", { id: "click" }),
|
|
@@ -63,6 +65,8 @@ export declare const all: (fibers: Iterable<MaybeFiber>, opts?: Partial<FiberOpt
|
|
|
63
65
|
*
|
|
64
66
|
* @example
|
|
65
67
|
* ```ts
|
|
68
|
+
* import { untilPromise, withTimeout } from "@thi.ng/fibers";
|
|
69
|
+
*
|
|
66
70
|
* // wait for fetch response max. 5 seconds
|
|
67
71
|
* const res = yield* withTimeout(untilPromise(fetch("example.json")), 5000);
|
|
68
72
|
*
|
|
@@ -92,6 +96,7 @@ export declare const timeSlice: (body: MaybeFiber, maxTime: number, opts?: Parti
|
|
|
92
96
|
*
|
|
93
97
|
* @example
|
|
94
98
|
* ```ts
|
|
99
|
+
* import { timeSliceIterable } from "@thi.ng/fibers";
|
|
95
100
|
* import { range } from "@this.ng/transducers";
|
|
96
101
|
*
|
|
97
102
|
* // consume & batch process iterable in 16ms time slices
|
|
@@ -177,6 +182,7 @@ export declare class Shuffle extends Fiber {
|
|
|
177
182
|
*
|
|
178
183
|
* @example
|
|
179
184
|
* ```ts
|
|
185
|
+
* import { shuffle } from "@thi.ng/fibers";
|
|
180
186
|
* import { repeatedly } from "@thi.ng/transducers";
|
|
181
187
|
*
|
|
182
188
|
* // create & run fiber with 4 children, executing in random order
|
|
@@ -219,6 +225,8 @@ export declare const shuffle: (fibers: Iterable<MaybeFiber>, opts?: Partial<Fibe
|
|
|
219
225
|
*
|
|
220
226
|
* @example
|
|
221
227
|
* ```ts
|
|
228
|
+
* import { asPromise } from "@thi.ng/fibers";
|
|
229
|
+
*
|
|
222
230
|
* (async () => {
|
|
223
231
|
* // create & spawn task/fiber
|
|
224
232
|
* const task = asPromise(function*() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/fibers",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.25",
|
|
4
4
|
"description": "Process hierarchies & operators for cooperative multitasking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"test": "bun test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.9.
|
|
39
|
-
"@thi.ng/arrays": "^2.8.
|
|
40
|
-
"@thi.ng/bench": "^3.4.
|
|
41
|
-
"@thi.ng/checks": "^3.5.
|
|
42
|
-
"@thi.ng/errors": "^2.4.
|
|
43
|
-
"@thi.ng/idgen": "^2.2.
|
|
44
|
-
"@thi.ng/logger": "^3.0.
|
|
45
|
-
"@thi.ng/random": "^3.6.
|
|
38
|
+
"@thi.ng/api": "^8.9.27",
|
|
39
|
+
"@thi.ng/arrays": "^2.8.4",
|
|
40
|
+
"@thi.ng/bench": "^3.4.30",
|
|
41
|
+
"@thi.ng/checks": "^3.5.1",
|
|
42
|
+
"@thi.ng/errors": "^2.4.19",
|
|
43
|
+
"@thi.ng/idgen": "^2.2.30",
|
|
44
|
+
"@thi.ng/logger": "^3.0.4",
|
|
45
|
+
"@thi.ng/random": "^3.6.34"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@microsoft/api-extractor": "^7.40.1",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"status": "alpha",
|
|
109
109
|
"year": 2023
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "d660ae8fd1bf64d919b4334f19509f1f539d70f6\n"
|
|
112
112
|
}
|