mol_wire_pub 1.0.14 → 1.0.18
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 +105 -21
- package/node.deps.json +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
package/README.md
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
Auto wiring modules. It gives ability to:
|
|
4
4
|
|
|
5
5
|
- Make any state observable using only 1.5KB lib. [$hyoo_crowd](https://github.com/hyoo-ru/crowd.hyoo.ru) as example.
|
|
6
|
-
- Automatic dynamic track runtime
|
|
7
|
-
- Memoize calculations with automatic
|
|
8
|
-
- Convert sync API to async and vice versa.
|
|
9
|
-
- Manage resources automatically with predictable deconstruction
|
|
10
|
-
- Optimize execution of tasks.
|
|
6
|
+
- Automatic dynamic track runtime value dependencies and optimize task execution order.
|
|
7
|
+
- Memoize calculations with automatic revalidation. Yes, it completely solves [the first of hard problem in computer science](https://www.karlton.org/2017/12/naming-things-hard/).
|
|
8
|
+
- Convert sync API to async and vice versa. Yes, it's a black magic of idempotence.
|
|
9
|
+
- Manage resources automatically with predictable deconstruction moment. Yes, we don't rely on garbage collector.
|
|
11
10
|
- Dramatically reduce source code size and increase reliability by implementing reactive architecture.
|
|
12
11
|
|
|
13
12
|
## Articles about
|
|
@@ -19,43 +18,128 @@ Auto wiring modules. It gives ability to:
|
|
|
19
18
|
|
|
20
19
|
### Decorators
|
|
21
20
|
|
|
22
|
-
- [$mol_wire_mem](
|
|
23
|
-
- [$mol_wire_field](
|
|
24
|
-
- [$mol_wire_method](
|
|
21
|
+
- [$mol_wire_mem](https://github.com/hyoo-ru/mam_mol/tree/master/wire/mem) - reactive memoizing property decorator
|
|
22
|
+
- [$mol_wire_field](https://github.com/hyoo-ru/mam_mol/tree/master/wire/field) - reactive memoizing field decorator
|
|
23
|
+
- [$mol_wire_method](https://github.com/hyoo-ru/mam_mol/tree/master/wire/method) - method decorator which run inside fiber
|
|
25
24
|
|
|
26
25
|
### Proxies
|
|
27
26
|
|
|
28
|
-
- [$mol_wire_sync](
|
|
29
|
-
- [$mol_wire_async](
|
|
27
|
+
- [$mol_wire_sync](https://github.com/hyoo-ru/mam_mol/tree/master/wire/sync) - converts async API to sync
|
|
28
|
+
- [$mol_wire_async](https://github.com/hyoo-ru/mam_mol/tree/master/wire/async) - converts sync API to async
|
|
30
29
|
|
|
31
30
|
### Functions
|
|
32
31
|
|
|
33
|
-
- [$mol_wire_probe](
|
|
34
|
-
- [$mol_wire_solid](
|
|
32
|
+
- [$mol_wire_probe](https://github.com/hyoo-ru/mam_mol/tree/master/wire/probe) - run code without state changes
|
|
33
|
+
- [$mol_wire_solid](https://github.com/hyoo-ru/mam_mol/tree/master/wire/solid) - make current fiber immortal
|
|
35
34
|
|
|
36
35
|
## Structures
|
|
37
36
|
|
|
38
|
-
- [$mol_wire_set](
|
|
39
|
-
- [$mol_wire_dom](
|
|
37
|
+
- [$mol_wire_set](https://github.com/hyoo-ru/mam_mol/tree/master/wire/set) - reactive Set
|
|
38
|
+
- [$mol_wire_dom](https://github.com/hyoo-ru/mam_mol/tree/master/wire/dom) - reactive DOM
|
|
40
39
|
|
|
41
40
|
## Low level API
|
|
42
41
|
|
|
43
42
|
### Pub/Sub
|
|
44
43
|
|
|
45
|
-
- [$mol_wire_pub](
|
|
46
|
-
- [$mol_wire_sub](
|
|
47
|
-
- [$mol_wire_pub_sub](
|
|
44
|
+
- [$mol_wire_pub](https://github.com/hyoo-ru/mam_mol/tree/master/wire/pub) - tiny publisher
|
|
45
|
+
- [$mol_wire_sub](https://github.com/hyoo-ru/mam_mol/tree/master/wire/sub) - generic subscriber interface
|
|
46
|
+
- [$mol_wire_pub_sub](https://github.com/hyoo-ru/mam_mol/tree/master/wire/pub/sub) - subscriber with retranslation support
|
|
48
47
|
- `$mol_wire_auto` - current tracking subscriber
|
|
49
48
|
|
|
50
49
|
### Reactivity
|
|
51
50
|
|
|
52
|
-
- [$mol_wire_fiber](
|
|
53
|
-
- [$mol_wire_cursor](
|
|
51
|
+
- [$mol_wire_fiber](https://github.com/hyoo-ru/mam_mol/tree/master/wire/fiber) - pausable task with sync API
|
|
52
|
+
- [$mol_wire_cursor](https://github.com/hyoo-ru/mam_mol/tree/master/wire/cursor) - subscription statuses
|
|
54
53
|
|
|
55
54
|
## NPM Bundles
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
### [mol_wire_lib](https://github.com/hyoo-ru/mam_mol/tree/master/wire/lib)
|
|
57
|
+
|
|
58
|
+
Lib with all production ready $mol_wire modules.
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
npm install mol_wire_lib
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
7KB [](https://bundlephobia.com/package/mol_wire_lib)
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import {
|
|
68
|
+
$mol_wire_mem as mem,
|
|
69
|
+
$mol_wire_method as action,
|
|
70
|
+
} from 'mol_wire_lib'
|
|
71
|
+
|
|
72
|
+
class User {
|
|
73
|
+
@mem(0) age( next = 0 ) { return next }
|
|
74
|
+
@mem(1) finger_exists( id: string, next = true ) { return next }
|
|
75
|
+
@action finger_cut( id: string ) { this.finger_exists( id, false ) }
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
const {
|
|
81
|
+
$mol_wire_mem: mem,
|
|
82
|
+
$mol_wire_method: actionn,
|
|
83
|
+
} = require( 'mol_wire_lib' )
|
|
84
|
+
|
|
85
|
+
class User {
|
|
86
|
+
age( next = 0 ) { return next }
|
|
87
|
+
finger_exists( id: string, next = true ) { return next }
|
|
88
|
+
finger_cut( id: string ) { this.finger_exists( id, false ) }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
mem(0)( User.prototype, 'age' )
|
|
92
|
+
mem(1)( User.prototype, 'finger_exists' )
|
|
93
|
+
action( User.prototype, 'finger_cut' )
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### [mol_wire_pub](https://github.com/hyoo-ru/mam_mol/tree/master/wire/pub)
|
|
97
|
+
|
|
98
|
+
Tiny lib to making any state observabe for other $mol_wire based libs.
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
npm install mol_wire_pub
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
1.5KB [](https://bundlephobia.com/package/mol_wire_pub)
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { $mol_wire_pub as Publisher } from 'mol_wire_pub'
|
|
108
|
+
|
|
109
|
+
let counter = 0
|
|
110
|
+
const pub = new Publisher
|
|
111
|
+
|
|
112
|
+
export function state() {
|
|
113
|
+
pub.track_promote()
|
|
114
|
+
return counter
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function increase() {
|
|
118
|
+
++ counter
|
|
119
|
+
pub.emit()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function decrease() {
|
|
123
|
+
-- counter
|
|
124
|
+
pub.emit()
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### [mol_wire_dom](https://github.com/hyoo-ru/mam_mol/tree/master/wire/dom)
|
|
129
|
+
|
|
130
|
+
Lib to make real DOM reactive.
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
npm install mol_wire_domm
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
7.5KB [](https://bundlephobia.com/package/mol_wire_dom)
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import { $mol_wire_dom as reactivate } from 'mol_wire_dom'
|
|
140
|
+
|
|
141
|
+
reactivate( document.body )
|
|
142
|
+
```
|
|
59
143
|
|
|
60
144
|
## Close alternatives
|
|
61
145
|
|
package/node.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/fail/fail.ts","mol/wire/cursor/cursor.ts","mol/wire/pub/pub.ts","mol/wire/sub/sub.ts","mol/wire/README.md","mol/wire/wire.ts"],"mods":{},"deps_in":{"mol/wire":{},"mol":{"mol/wire":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/wire/sub":{"mol/wire":-1},"mol/wire/pub":{"mol/wire/sub":-1},"mol/fail":{"mol/wire/pub":-4},"mol/wire/cursor":{"mol/wire/pub":-3}},"deps_out":{"mol/wire/pub":{"mol/fail":-4,"mol/wire/cursor":-3},"mol/wire":{"mol":-9007199254740991,"mol/wire/sub":-1},"mol":{"":-9007199254740991},"mol/wire/sub":{"mol/wire/pub":-1},"mol/fail":{"mol":-9007199254740991},"mol/wire/cursor":{}},"sloc":{"LICENSE":113,"md":
|
|
1
|
+
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/fail/fail.ts","mol/wire/cursor/cursor.ts","mol/wire/pub/pub.ts","mol/wire/sub/sub.ts","mol/wire/README.md","mol/wire/wire.ts"],"mods":{},"deps_in":{"mol/wire":{},"mol":{"mol/wire":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/wire/sub":{"mol/wire":-1},"mol/wire/pub":{"mol/wire/sub":-1},"mol/fail":{"mol/wire/pub":-4},"mol/wire/cursor":{"mol/wire/pub":-3}},"deps_out":{"mol/wire/pub":{"mol/fail":-4,"mol/wire/cursor":-3},"mol/wire":{"mol":-9007199254740991,"mol/wire/sub":-1},"mol":{"":-9007199254740991},"mol/wire/sub":{"mol/wire/pub":-1},"mol/fail":{"mol":-9007199254740991},"mol/wire/cursor":{}},"sloc":{"LICENSE":113,"md":602,"tree":31,"js":10,"ts":184,"json":85,"lock":939,"CNAME":1,"html":1},"deps":{"mol/wire/pub":{"..":-9007199254740991,"/mol/wire/pub":-1,"/mol/wire/sub":-3,"/mol/fail":-4,"/mol/wire/auto":-3,"/mol/wire/cursor/stale":-3,"/mol/wire/affected/length":-3,"/mol/wire/affected/pop":-4,"/mol/wire/cursor/doubt":-4,"/mol/wire/affected/push":-4},"mol/wire":{"..":-9007199254740991,"/mol/wire/auto":-1,"/mol/wire/sub":-1,"/mol/wire/affected":-1},"mol":{"..":-9007199254740991},"":{},"mol/wire/sub":{"..":-9007199254740991,"/mol/wire/sub":-1,"/mol/wire/pub":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/wire/cursor":{"..":-9007199254740991,"/mol/wire/cursor":-1}}}
|
package/package.json
CHANGED
package/web.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/fail/fail.ts","mol/wire/cursor/cursor.ts","mol/wire/pub/pub.ts","mol/wire/sub/sub.ts","mol/wire/README.md","mol/wire/wire.ts"],"mods":{},"deps_in":{"mol/wire":{},"mol":{"mol/wire":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/wire/sub":{"mol/wire":-1},"mol/wire/pub":{"mol/wire/sub":-1},"mol/fail":{"mol/wire/pub":-4},"mol/wire/cursor":{"mol/wire/pub":-3}},"deps_out":{"mol/wire/pub":{"mol/fail":-4,"mol/wire/cursor":-3},"mol/wire":{"mol":-9007199254740991,"mol/wire/sub":-1},"mol":{"":-9007199254740991},"mol/wire/sub":{"mol/wire/pub":-1},"mol/fail":{"mol":-9007199254740991},"mol/wire/cursor":{}},"sloc":{"LICENSE":113,"md":
|
|
1
|
+
{"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/fail/fail.ts","mol/wire/cursor/cursor.ts","mol/wire/pub/pub.ts","mol/wire/sub/sub.ts","mol/wire/README.md","mol/wire/wire.ts"],"mods":{},"deps_in":{"mol/wire":{},"mol":{"mol/wire":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/wire/sub":{"mol/wire":-1},"mol/wire/pub":{"mol/wire/sub":-1},"mol/fail":{"mol/wire/pub":-4},"mol/wire/cursor":{"mol/wire/pub":-3}},"deps_out":{"mol/wire/pub":{"mol/fail":-4,"mol/wire/cursor":-3},"mol/wire":{"mol":-9007199254740991,"mol/wire/sub":-1},"mol":{"":-9007199254740991},"mol/wire/sub":{"mol/wire/pub":-1},"mol/fail":{"mol":-9007199254740991},"mol/wire/cursor":{}},"sloc":{"LICENSE":113,"md":602,"tree":31,"js":10,"ts":184,"json":85,"lock":939,"CNAME":1,"html":1},"deps":{"mol/wire/pub":{"..":-9007199254740991,"/mol/wire/pub":-1,"/mol/wire/sub":-3,"/mol/fail":-4,"/mol/wire/auto":-3,"/mol/wire/cursor/stale":-3,"/mol/wire/affected/length":-3,"/mol/wire/affected/pop":-4,"/mol/wire/cursor/doubt":-4,"/mol/wire/affected/push":-4},"mol/wire":{"..":-9007199254740991,"/mol/wire/auto":-1,"/mol/wire/sub":-1,"/mol/wire/affected":-1},"mol":{"..":-9007199254740991},"":{},"mol/wire/sub":{"..":-9007199254740991,"/mol/wire/sub":-1,"/mol/wire/pub":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/wire/cursor":{"..":-9007199254740991,"/mol/wire/cursor":-1}}}
|