@thi.ng/fibers 0.3.0 → 0.3.2
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 +3 -2
- package/fiber.d.ts +1 -1
- package/fiber.js +3 -2
- package/ops.d.ts +3 -4
- package/ops.js +3 -4
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](https://mastodon.thi.ng/@toxi)
|
|
9
9
|
|
|
10
10
|
This project is part of the
|
|
11
|
-
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
11
|
+
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo and anti-framework.
|
|
12
12
|
|
|
13
13
|
- [About](#about)
|
|
14
14
|
- [Basic usage](#basic-usage)
|
|
@@ -376,7 +376,7 @@ For Node.js REPL:
|
|
|
376
376
|
const fibers = await import("@thi.ng/fibers");
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 2.
|
|
379
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 2.27 KB
|
|
380
380
|
|
|
381
381
|
## Dependencies
|
|
382
382
|
|
|
@@ -401,6 +401,7 @@ A selection:
|
|
|
401
401
|
|:----------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------|:-----------------------------------------------------|:----------------------------------------------------------------------------------|
|
|
402
402
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ascii-raymarch.jpg" width="240"/> | ASCII art raymarching with thi.ng/shader-ast & thi.ng/text-canvas | [Demo](https://demo.thi.ng/umbrella/ascii-raymarch/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/ascii-raymarch) |
|
|
403
403
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fiber-basics.png" width="240"/> | Fiber-based cooperative multitasking basics | [Demo](https://demo.thi.ng/umbrella/fiber-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/fiber-basics) |
|
|
404
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ifs-fractal.jpg" width="240"/> | Barnsley fern IFS fractal renderer | [Demo](https://demo.thi.ng/umbrella/ifs-fractal/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/ifs-fractal) |
|
|
404
405
|
|
|
405
406
|
## API
|
|
406
407
|
|
package/fiber.d.ts
CHANGED
|
@@ -175,7 +175,7 @@ export declare class Fiber<T = any> implements IDeref<T | undefined>, IID<string
|
|
|
175
175
|
run(): this;
|
|
176
176
|
/**
|
|
177
177
|
* Starts fiber execution using the provided higher-order loop/interval
|
|
178
|
-
* `handler` (e.g. see {@link Fiber.
|
|
178
|
+
* `handler` (e.g. see {@link Fiber.run}).
|
|
179
179
|
*
|
|
180
180
|
* @remarks
|
|
181
181
|
* That given `handler` is used to repeatedly schedule the next execution of
|
package/fiber.js
CHANGED
|
@@ -9,7 +9,7 @@ import { EVENT_FIBER_CANCELED, EVENT_FIBER_DONE, EVENT_FIBER_ERROR, STATE_ACTIVE
|
|
|
9
9
|
let DEFAULT_ID_GEN = prefixed("fib-", monotonic());
|
|
10
10
|
export const setDefaultIDGen = (gen) => (DEFAULT_ID_GEN = gen);
|
|
11
11
|
const NO_RESULT = { done: false, value: undefined };
|
|
12
|
-
|
|
12
|
+
let Fiber = Fiber_1 = class Fiber {
|
|
13
13
|
constructor(gen, opts) {
|
|
14
14
|
this.state = STATE_NEW;
|
|
15
15
|
this.autoTerminate = false;
|
|
@@ -317,7 +317,7 @@ export let Fiber = Fiber_1 = class Fiber {
|
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
* Starts fiber execution using the provided higher-order loop/interval
|
|
320
|
-
* `handler` (e.g. see {@link Fiber.
|
|
320
|
+
* `handler` (e.g. see {@link Fiber.run}).
|
|
321
321
|
*
|
|
322
322
|
* @remarks
|
|
323
323
|
* That given `handler` is used to repeatedly schedule the next execution of
|
|
@@ -353,6 +353,7 @@ export let Fiber = Fiber_1 = class Fiber {
|
|
|
353
353
|
Fiber = Fiber_1 = __decorate([
|
|
354
354
|
INotifyMixin
|
|
355
355
|
], Fiber);
|
|
356
|
+
export { Fiber };
|
|
356
357
|
/**
|
|
357
358
|
* Functional syntax sugar for {@link Fiber} constructor. The `opts` are only
|
|
358
359
|
* used if given a generator or {@link FiberFactory}.
|
package/ops.d.ts
CHANGED
|
@@ -107,10 +107,9 @@ export declare function untilState<T>(state: T, pred: Predicate<T>): Generator<u
|
|
|
107
107
|
* Returns a fiber which "blocks" until the given `promise` resolves or rejects.
|
|
108
108
|
* In the latter case, the fiber will throw the received error.
|
|
109
109
|
*
|
|
110
|
-
* @
|
|
111
|
-
* If the
|
|
112
|
-
*
|
|
113
|
-
* details.
|
|
110
|
+
* @remarks
|
|
111
|
+
* If the fiber was added to a parent {@link Fiber}, the error will be logged
|
|
112
|
+
* and the fiber removed from the parent. See {@link Fiber.next} for details.
|
|
114
113
|
*
|
|
115
114
|
* @param promise
|
|
116
115
|
*/
|
package/ops.js
CHANGED
|
@@ -156,10 +156,9 @@ export function* untilState(state, pred) {
|
|
|
156
156
|
* Returns a fiber which "blocks" until the given `promise` resolves or rejects.
|
|
157
157
|
* In the latter case, the fiber will throw the received error.
|
|
158
158
|
*
|
|
159
|
-
* @
|
|
160
|
-
* If the
|
|
161
|
-
*
|
|
162
|
-
* details.
|
|
159
|
+
* @remarks
|
|
160
|
+
* If the fiber was added to a parent {@link Fiber}, the error will be logged
|
|
161
|
+
* and the fiber removed from the parent. See {@link Fiber.next} for details.
|
|
163
162
|
*
|
|
164
163
|
* @param promise
|
|
165
164
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/fibers",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Process hierarchies & operators for cooperative multitasking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.9.
|
|
38
|
-
"@thi.ng/arrays": "^2.5.
|
|
39
|
-
"@thi.ng/bench": "^3.4.
|
|
40
|
-
"@thi.ng/checks": "^3.4.
|
|
41
|
-
"@thi.ng/errors": "^2.3.
|
|
42
|
-
"@thi.ng/idgen": "^2.2.
|
|
43
|
-
"@thi.ng/logger": "^1.4.
|
|
44
|
-
"@thi.ng/random": "^3.6.
|
|
37
|
+
"@thi.ng/api": "^8.9.5",
|
|
38
|
+
"@thi.ng/arrays": "^2.5.21",
|
|
39
|
+
"@thi.ng/bench": "^3.4.6",
|
|
40
|
+
"@thi.ng/checks": "^3.4.5",
|
|
41
|
+
"@thi.ng/errors": "^2.3.5",
|
|
42
|
+
"@thi.ng/idgen": "^2.2.6",
|
|
43
|
+
"@thi.ng/logger": "^1.4.21",
|
|
44
|
+
"@thi.ng/random": "^3.6.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@microsoft/api-extractor": "^7.36.4",
|
|
48
|
-
"@thi.ng/testament": "^0.3.
|
|
48
|
+
"@thi.ng/testament": "^0.3.23",
|
|
49
49
|
"rimraf": "^5.0.1",
|
|
50
50
|
"tools": "^0.0.1",
|
|
51
|
-
"typedoc": "^0.
|
|
52
|
-
"typescript": "^5.
|
|
51
|
+
"typedoc": "^0.25.0",
|
|
52
|
+
"typescript": "^5.2.2"
|
|
53
53
|
},
|
|
54
54
|
"keywords": [
|
|
55
55
|
"blocking",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"status": "alpha",
|
|
109
109
|
"year": 2023
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "5929dd20497668496af13415cdf784a4d6f69aa3\n"
|
|
112
112
|
}
|