@thi.ng/fibers 1.0.5 → 1.0.7
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 -1
- package/fiber.d.ts +3 -3
- package/fiber.js +3 -3
- package/ops.d.ts +8 -8
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 189 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/fiber.d.ts
CHANGED
|
@@ -79,8 +79,8 @@ export declare class Fiber<T = any> implements IDeref<Maybe<T>>, IID<string>, IN
|
|
|
79
79
|
* {@link Fiber.childForID}.
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
|
-
* ```ts
|
|
83
|
-
* import { fiber } from "@thi.ng/fibers";
|
|
82
|
+
* ```ts tangle:../export/fork.ts
|
|
83
|
+
* import { fiber, wait } from "@thi.ng/fibers";
|
|
84
84
|
*
|
|
85
85
|
* fiber(function* (ctx) {
|
|
86
86
|
* console.log("main start")
|
|
@@ -205,7 +205,7 @@ export declare class Fiber<T = any> implements IDeref<Maybe<T>>, IID<string>, IN
|
|
|
205
205
|
* `handler` must only manage a single execution step, not multiple.
|
|
206
206
|
*
|
|
207
207
|
* @example
|
|
208
|
-
* ```ts
|
|
208
|
+
* ```ts tangle:../export/run-with.ts
|
|
209
209
|
* import { fiber } from "@thi.ng/fibers";
|
|
210
210
|
*
|
|
211
211
|
* // start with custom higher frequency handler
|
package/fiber.js
CHANGED
|
@@ -141,8 +141,8 @@ let Fiber = class {
|
|
|
141
141
|
* {@link Fiber.childForID}.
|
|
142
142
|
*
|
|
143
143
|
* @example
|
|
144
|
-
* ```ts
|
|
145
|
-
* import { fiber } from "@thi.ng/fibers";
|
|
144
|
+
* ```ts tangle:../export/fork.ts
|
|
145
|
+
* import { fiber, wait } from "@thi.ng/fibers";
|
|
146
146
|
*
|
|
147
147
|
* fiber(function* (ctx) {
|
|
148
148
|
* console.log("main start")
|
|
@@ -365,7 +365,7 @@ let Fiber = class {
|
|
|
365
365
|
* `handler` must only manage a single execution step, not multiple.
|
|
366
366
|
*
|
|
367
367
|
* @example
|
|
368
|
-
* ```ts
|
|
368
|
+
* ```ts tangle:../export/run-with.ts
|
|
369
369
|
* import { fiber } from "@thi.ng/fibers";
|
|
370
370
|
*
|
|
371
371
|
* // start with custom higher frequency handler
|
package/ops.d.ts
CHANGED
|
@@ -95,14 +95,14 @@ export declare const timeSlice: (body: MaybeFiber, maxTime: number, opts?: Parti
|
|
|
95
95
|
* given `consume` function in order to process these values further.
|
|
96
96
|
*
|
|
97
97
|
* @example
|
|
98
|
-
* ```ts
|
|
98
|
+
* ```ts tangle:../export/timeslice-iterable.ts
|
|
99
99
|
* import { timeSliceIterable } from "@thi.ng/fibers";
|
|
100
100
|
* import { range } from "@thi.ng/transducers";
|
|
101
101
|
*
|
|
102
102
|
* // consume & batch process iterable in 16ms time slices
|
|
103
103
|
* timeSliceIterable(
|
|
104
104
|
* range(1_000_000),
|
|
105
|
-
* (chunk) => console.log(chunk),
|
|
105
|
+
* (chunk) => console.log("items:", chunk.length),
|
|
106
106
|
* 16
|
|
107
107
|
* ).run();
|
|
108
108
|
* ```
|
|
@@ -181,15 +181,15 @@ export declare class Shuffle extends Fiber {
|
|
|
181
181
|
* [`SYSTEM`](https://docs.thi.ng/umbrella/random/variables/SYSTEM.html).
|
|
182
182
|
*
|
|
183
183
|
* @example
|
|
184
|
-
* ```ts
|
|
184
|
+
* ```ts tangle:../export/shuffle.ts
|
|
185
185
|
* import { shuffle } from "@thi.ng/fibers";
|
|
186
186
|
* import { repeatedly } from "@thi.ng/transducers";
|
|
187
187
|
*
|
|
188
|
-
* // create & run fiber with
|
|
188
|
+
* // create & run fiber with 16 children, executing in random order
|
|
189
189
|
* shuffle(
|
|
190
190
|
* repeatedly(
|
|
191
|
-
* (id) => function*() { while(true) { console.log(`worker
|
|
192
|
-
*
|
|
191
|
+
* (id) => function*() { while(true) { console.log(`worker #${id}`); yield; } },
|
|
192
|
+
* 16
|
|
193
193
|
* )
|
|
194
194
|
* ).run()
|
|
195
195
|
*
|
|
@@ -224,8 +224,8 @@ export declare const shuffle: (fibers: Iterable<MaybeFiber>, opts?: Partial<Fibe
|
|
|
224
224
|
* `catch` handler indicating the error has been dealt with.
|
|
225
225
|
*
|
|
226
226
|
* @example
|
|
227
|
-
* ```ts
|
|
228
|
-
* import { asPromise } from "@thi.ng/fibers";
|
|
227
|
+
* ```ts tangle:../export/as-promise.ts
|
|
228
|
+
* import { asPromise, wait } from "@thi.ng/fibers";
|
|
229
229
|
*
|
|
230
230
|
* (async () => {
|
|
231
231
|
* // create & spawn task/fiber
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/fibers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Process hierarchies & operators for cooperative multitasking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/arrays": "^2.9.
|
|
41
|
-
"@thi.ng/bench": "^3.5.
|
|
42
|
-
"@thi.ng/buffers": "^0.1.
|
|
43
|
-
"@thi.ng/checks": "^3.6.
|
|
44
|
-
"@thi.ng/errors": "^2.5.
|
|
45
|
-
"@thi.ng/idgen": "^2.2.
|
|
46
|
-
"@thi.ng/logger": "^3.0.
|
|
47
|
-
"@thi.ng/random": "^3.8.
|
|
39
|
+
"@thi.ng/api": "^8.11.4",
|
|
40
|
+
"@thi.ng/arrays": "^2.9.8",
|
|
41
|
+
"@thi.ng/bench": "^3.5.9",
|
|
42
|
+
"@thi.ng/buffers": "^0.1.5",
|
|
43
|
+
"@thi.ng/checks": "^3.6.6",
|
|
44
|
+
"@thi.ng/errors": "^2.5.9",
|
|
45
|
+
"@thi.ng/idgen": "^2.2.43",
|
|
46
|
+
"@thi.ng/logger": "^3.0.14",
|
|
47
|
+
"@thi.ng/random": "^3.8.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@microsoft/api-extractor": "^7.47.0",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"status": "alpha",
|
|
114
114
|
"year": 2023
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "4a2f35b6e720cc4ad3e2ff2549b78beb3f80732e\n"
|
|
117
117
|
}
|