@thi.ng/fibers 0.2.2 → 0.3.0
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 +9 -1
- package/README.md +4 -3
- package/fiber.d.ts +8 -2
- package/fiber.js +11 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-08-
|
|
3
|
+
- **Last updated**: 2023-08-14T13:30:45Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,14 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/fibers@0.3.0) (2023-08-14)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update .run() default handlers ([6137e7a](https://github.com/thi-ng/umbrella/commit/6137e7a))
|
|
17
|
+
- use `setImmediate()` as default for non-browser env
|
|
18
|
+
- update tests
|
|
19
|
+
|
|
12
20
|
## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/fibers@0.2.0) (2023-08-10)
|
|
13
21
|
|
|
14
22
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -397,9 +397,10 @@ directory are using this package.
|
|
|
397
397
|
|
|
398
398
|
A selection:
|
|
399
399
|
|
|
400
|
-
| Screenshot
|
|
401
|
-
|
|
402
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
400
|
+
| Screenshot | Description | Live demo | Source |
|
|
401
|
+
|:----------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------|:-----------------------------------------------------|:----------------------------------------------------------------------------------|
|
|
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
|
+
| <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) |
|
|
403
404
|
|
|
404
405
|
## API
|
|
405
406
|
|
package/fiber.d.ts
CHANGED
|
@@ -163,8 +163,14 @@ export declare class Fiber<T = any> implements IDeref<T | undefined>, IID<string
|
|
|
163
163
|
removeListener(id: FiberEventType, fn: Listener<FiberEventType>, scope?: any): boolean;
|
|
164
164
|
notify(event: $Event<FiberEventType>): boolean;
|
|
165
165
|
/**
|
|
166
|
-
* Calls {@link Fiber.runWith} using default loop handlers
|
|
167
|
-
*
|
|
166
|
+
* Calls {@link Fiber.runWith} using default loop handlers.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* Current default handlers:
|
|
170
|
+
*
|
|
171
|
+
* - `requestAnimationFrame()` in browsers
|
|
172
|
+
* - `setImmediate()` in NodeJs
|
|
173
|
+
* - `setTimeout(fn, 1)` otherwise
|
|
168
174
|
*/
|
|
169
175
|
run(): this;
|
|
170
176
|
/**
|
package/fiber.js
CHANGED
|
@@ -299,13 +299,21 @@ export let Fiber = Fiber_1 = class Fiber {
|
|
|
299
299
|
// @ts-ignore mixin
|
|
300
300
|
notify(event) { }
|
|
301
301
|
/**
|
|
302
|
-
* Calls {@link Fiber.runWith} using default loop handlers
|
|
303
|
-
*
|
|
302
|
+
* Calls {@link Fiber.runWith} using default loop handlers.
|
|
303
|
+
*
|
|
304
|
+
* @remarks
|
|
305
|
+
* Current default handlers:
|
|
306
|
+
*
|
|
307
|
+
* - `requestAnimationFrame()` in browsers
|
|
308
|
+
* - `setImmediate()` in NodeJs
|
|
309
|
+
* - `setTimeout(fn, 1)` otherwise
|
|
304
310
|
*/
|
|
305
311
|
run() {
|
|
306
312
|
return this.runWith(typeof requestAnimationFrame === "function"
|
|
307
313
|
? requestAnimationFrame
|
|
308
|
-
:
|
|
314
|
+
: typeof setImmediate === "function"
|
|
315
|
+
? setImmediate
|
|
316
|
+
: (fn) => setTimeout(fn, 1));
|
|
309
317
|
}
|
|
310
318
|
/**
|
|
311
319
|
* Starts fiber execution using the provided higher-order loop/interval
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/fibers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Process hierarchies & operators for cooperative multitasking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@thi.ng/api": "^8.9.3",
|
|
38
|
-
"@thi.ng/arrays": "^2.5.
|
|
38
|
+
"@thi.ng/arrays": "^2.5.19",
|
|
39
39
|
"@thi.ng/bench": "^3.4.4",
|
|
40
40
|
"@thi.ng/checks": "^3.4.3",
|
|
41
41
|
"@thi.ng/errors": "^2.3.3",
|
|
42
|
-
"@thi.ng/idgen": "^2.2.
|
|
42
|
+
"@thi.ng/idgen": "^2.2.4",
|
|
43
43
|
"@thi.ng/logger": "^1.4.19",
|
|
44
|
-
"@thi.ng/random": "^3.6.
|
|
44
|
+
"@thi.ng/random": "^3.6.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@microsoft/api-extractor": "^7.36.4",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"status": "alpha",
|
|
109
109
|
"year": 2023
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "4e8f1abeeba7b919e069954eada917ecd2e9a8e9\n"
|
|
112
112
|
}
|