@davidcal/frosth 1.3.0 → 1.4.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Frosth - Yet another UI framework
2
2
 
3
- **Latest version**: v1.3.0
3
+ **Latest version**: v1.4.0
4
4
 
5
5
  ## Motivation
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davidcal/frosth",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Async-first CRUD-last UI framework that treats encapsulation as a solved problem.",
5
5
  "type": "module",
6
6
  "main": "./src/sigew.js",
@@ -1,3 +1,5 @@
1
+ import { create_signal } from "./create_signal.js";
2
+
1
3
  /**
2
4
  * A beacon is a valueless-sink. The output is a stable interface as provided on creation. Subscribers are notified whenever the beacon is fired.
3
5
  */
@@ -0,0 +1,37 @@
1
+ import { create_beacon } from "./create_beacon.js";
2
+
3
+ export const create_stream = () => {
4
+ // activity: content-agnostic term for a payload in a stream, whether that be an event or an action.
5
+ let activity_seq = 0;
6
+
7
+ let outstanding_activities = [];
8
+
9
+ const drain = () => {
10
+ const activities = outstanding_activities;
11
+
12
+ outstanding_activities = [];
13
+
14
+ return activities;
15
+ };
16
+
17
+ const reader = {
18
+ drain,
19
+ };
20
+
21
+ const beacon = create_beacon(reader);
22
+
23
+ const result = (s) => beacon(s);
24
+
25
+ result.emit = (body) => {
26
+ const activity = {
27
+ seq: activity_seq++,
28
+ body,
29
+ };
30
+
31
+ outstanding_activities.push(activity);
32
+
33
+ beacon.fire();
34
+ };
35
+
36
+ return result;
37
+ };
package/src/sigew.js CHANGED
@@ -7,12 +7,14 @@ import { render } from "./render.js";
7
7
  import { MARK_INSTALLABLE } from "./constants.js";
8
8
  import { create_memo } from "./create_memo.js";
9
9
  import { create_beacon } from "./create_beacon.js";
10
+ import { create_stream } from "./create_stream.js";
10
11
 
11
12
  export { create_self };
12
13
  export { create_signal };
13
14
  export { h };
14
15
  export { create_memo };
15
16
  export { create_beacon };
17
+ export { create_stream };
16
18
 
17
19
  export const installarea = (s) => {
18
20
  const storage = s.create_housed_signal(() => undefined);