@davidcal/frosth 1.3.0 → 1.5.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 +1 -1
- package/package.json +1 -1
- package/src/create_beacon.js +2 -0
- package/src/create_self.js +1 -1
- package/src/create_stream.js +50 -0
- package/src/sigew.js +2 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/src/create_beacon.js
CHANGED
package/src/create_self.js
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
result.emit_many = (bodies) => {
|
|
37
|
+
for (const body of bodies) {
|
|
38
|
+
const activity = {
|
|
39
|
+
seq: activity_seq++,
|
|
40
|
+
body,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
outstanding_activities.push(activity);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
beacon.fire();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return result;
|
|
50
|
+
};
|
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);
|