@thi.ng/fibers 0.2.3 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-08-12T13:14:08Z
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 | Description | Live demo | Source |
401
- |:--------------------------------------------------------------------------------------------------------------------|:--------------------------------------------|:---------------------------------------------------|:--------------------------------------------------------------------------------|
402
- | <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) |
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
- * (`requestAnimationFrame()` in browsers, `setTimeout(fn, 16)` otherwise).
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
- * (`requestAnimationFrame()` in browsers, `setTimeout(fn, 16)` otherwise).
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
- : (fn) => setTimeout(fn, 16));
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.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Process hierarchies & operators for cooperative multitasking",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -108,5 +108,5 @@
108
108
  "status": "alpha",
109
109
  "year": 2023
110
110
  },
111
- "gitHead": "4154283d772824d4b57d4b7ab97be22a6e1ffdd7\n"
111
+ "gitHead": "4e8f1abeeba7b919e069954eada917ecd2e9a8e9\n"
112
112
  }