@ersbeth/picoflow 0.0.1
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/.vscode/settings.json +5 -0
- package/README.md +151 -0
- package/api/doc/index.md +31 -0
- package/api/doc/picoflow.derivation.md +55 -0
- package/api/doc/picoflow.effect.md +55 -0
- package/api/doc/picoflow.flowderivation._constructor_.md +49 -0
- package/api/doc/picoflow.flowderivation.get.md +23 -0
- package/api/doc/picoflow.flowderivation.md +86 -0
- package/api/doc/picoflow.flowdisposer.md +13 -0
- package/api/doc/picoflow.floweffect._constructor_.md +49 -0
- package/api/doc/picoflow.floweffect.dispose.md +21 -0
- package/api/doc/picoflow.floweffect.disposed.md +13 -0
- package/api/doc/picoflow.floweffect.md +131 -0
- package/api/doc/picoflow.flowgetter.md +15 -0
- package/api/doc/picoflow.flowmap._lastdeleted.md +21 -0
- package/api/doc/picoflow.flowmap._lastset.md +21 -0
- package/api/doc/picoflow.flowmap.delete.md +57 -0
- package/api/doc/picoflow.flowmap.md +135 -0
- package/api/doc/picoflow.flowmap.setat.md +73 -0
- package/api/doc/picoflow.flowobservable.get.md +19 -0
- package/api/doc/picoflow.flowobservable.md +54 -0
- package/api/doc/picoflow.flowresource._constructor_.md +65 -0
- package/api/doc/picoflow.flowresource.fetch.md +27 -0
- package/api/doc/picoflow.flowresource.get.md +23 -0
- package/api/doc/picoflow.flowresource.md +100 -0
- package/api/doc/picoflow.flowsetter.md +13 -0
- package/api/doc/picoflow.flowsignal.dispose.md +25 -0
- package/api/doc/picoflow.flowsignal.disposed.md +18 -0
- package/api/doc/picoflow.flowsignal.md +111 -0
- package/api/doc/picoflow.flowsignal.trigger.md +25 -0
- package/api/doc/picoflow.flowstate._constructor_.md +49 -0
- package/api/doc/picoflow.flowstate.get.md +23 -0
- package/api/doc/picoflow.flowstate.md +100 -0
- package/api/doc/picoflow.flowstate.set.md +61 -0
- package/api/doc/picoflow.flowstream._constructor_.md +65 -0
- package/api/doc/picoflow.flowstream.dispose.md +21 -0
- package/api/doc/picoflow.flowstream.get.md +23 -0
- package/api/doc/picoflow.flowstream.md +100 -0
- package/api/doc/picoflow.flowupdater.md +19 -0
- package/api/doc/picoflow.flowwatcher.md +15 -0
- package/api/doc/picoflow.map.md +59 -0
- package/api/doc/picoflow.md +287 -0
- package/api/doc/picoflow.resource.md +71 -0
- package/api/doc/picoflow.signal.md +19 -0
- package/api/doc/picoflow.state.md +55 -0
- package/api/doc/picoflow.stream.md +71 -0
- package/api/picoflow.api.md +145 -0
- package/api-extractor.json +60 -0
- package/biome.json +34 -0
- package/dist/picoflow.js +572 -0
- package/dist/types/creators.d.ts +70 -0
- package/dist/types/creators.d.ts.map +1 -0
- package/dist/types/derivation.d.ts +58 -0
- package/dist/types/derivation.d.ts.map +1 -0
- package/dist/types/effect.d.ts +108 -0
- package/dist/types/effect.d.ts.map +1 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/map.d.ts +75 -0
- package/dist/types/map.d.ts.map +1 -0
- package/dist/types/observable.d.ts +40 -0
- package/dist/types/observable.d.ts.map +1 -0
- package/dist/types/resource.d.ts +46 -0
- package/dist/types/resource.d.ts.map +1 -0
- package/dist/types/signal.d.ts +111 -0
- package/dist/types/signal.d.ts.map +1 -0
- package/dist/types/state.d.ts +39 -0
- package/dist/types/state.d.ts.map +1 -0
- package/dist/types/stream.d.ts +71 -0
- package/dist/types/stream.d.ts.map +1 -0
- package/package.json +40 -0
- package/src/creators.ts +101 -0
- package/src/derivation.ts +96 -0
- package/src/effect.ts +152 -0
- package/src/index.ts +30 -0
- package/src/map.ts +83 -0
- package/src/observable.ts +50 -0
- package/src/resource.ts +64 -0
- package/src/signal.ts +166 -0
- package/src/state.ts +52 -0
- package/src/stream.ts +99 -0
- package/test/derivation.test.ts +422 -0
- package/test/map.test.ts +106 -0
- package/test/resource.test.ts +127 -0
- package/test/signal.test.ts +59 -0
- package/test/state.test.ts +89 -0
- package/test/stream.test.ts +171 -0
- package/tsconfig.json +22 -0
- package/vite.config.ts +26 -0
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowMap](./picoflow.flowmap.md) > [$lastDeleted](./picoflow.flowmap._lastdeleted.md)
|
|
4
|
+
|
|
5
|
+
## FlowMap.$lastDeleted property
|
|
6
|
+
|
|
7
|
+
A reactive state that holds the most recent key and value that were deleted.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
$lastDeleted: FlowState<{
|
|
13
|
+
key?: K;
|
|
14
|
+
value?: V;
|
|
15
|
+
}>;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Remarks
|
|
19
|
+
|
|
20
|
+
When a key is deleted via [FlowMap.delete()](./picoflow.flowmap.delete.md)<!-- -->, this state is updated with the corresponding key and its last known value.
|
|
21
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowMap](./picoflow.flowmap.md) > [$lastSet](./picoflow.flowmap._lastset.md)
|
|
4
|
+
|
|
5
|
+
## FlowMap.$lastSet property
|
|
6
|
+
|
|
7
|
+
A reactive state that holds the most recent key and value that were set.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
$lastSet: FlowState<{
|
|
13
|
+
key?: K;
|
|
14
|
+
value?: V;
|
|
15
|
+
}>;
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Remarks
|
|
19
|
+
|
|
20
|
+
When a key is set via [FlowMap.setAt()](./picoflow.flowmap.setat.md)<!-- -->, this state is updated with the corresponding key and value.
|
|
21
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowMap](./picoflow.flowmap.md) > [delete](./picoflow.flowmap.delete.md)
|
|
4
|
+
|
|
5
|
+
## FlowMap.delete() method
|
|
6
|
+
|
|
7
|
+
Deletes the value at the specified key from the underlying map.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
delete(key: K): void;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
key
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
K
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
The key to delete.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
**Returns:**
|
|
51
|
+
|
|
52
|
+
void
|
|
53
|
+
|
|
54
|
+
## Remarks
|
|
55
|
+
|
|
56
|
+
This method removes the key from the internal map, emits the deleted key and its corresponding value via [FlowMap.$lastDeleted](./picoflow.flowmap._lastdeleted.md)<!-- -->, and notifies subscribers of the change.
|
|
57
|
+
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowMap](./picoflow.flowmap.md)
|
|
4
|
+
|
|
5
|
+
## FlowMap class
|
|
6
|
+
|
|
7
|
+
Represents a reactive map of states that extends [FlowState](./picoflow.flowstate.md) for a Map of key/value pairs.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare class FlowMap<K, V> extends FlowState<Map<K, V>>
|
|
13
|
+
```
|
|
14
|
+
**Extends:** [FlowState](./picoflow.flowstate.md)<!-- --><Map<K, V>>
|
|
15
|
+
|
|
16
|
+
## Remarks
|
|
17
|
+
|
|
18
|
+
FlowMap wraps a native Map and provides reactive signals for fine-grained tracking of updates to the map. In addition to the reactive capabilities inherited from FlowState, it exposes two public signals:
|
|
19
|
+
|
|
20
|
+
\*\*$lastSet\*\*: A FlowState that holds the most recent key-value pair that was set.
|
|
21
|
+
|
|
22
|
+
\*\*$lastDeleted\*\*: A FlowState that holds the most recent key-value pair that was deleted.
|
|
23
|
+
|
|
24
|
+
Use [FlowMap.setAt()](./picoflow.flowmap.setat.md) to set a key-value pair and [FlowMap.delete()](./picoflow.flowmap.delete.md) to remove a key.
|
|
25
|
+
|
|
26
|
+
## Properties
|
|
27
|
+
|
|
28
|
+
<table><thead><tr><th>
|
|
29
|
+
|
|
30
|
+
Property
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
</th><th>
|
|
34
|
+
|
|
35
|
+
Modifiers
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</th><th>
|
|
39
|
+
|
|
40
|
+
Type
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</th><th>
|
|
44
|
+
|
|
45
|
+
Description
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</th></tr></thead>
|
|
49
|
+
<tbody><tr><td>
|
|
50
|
+
|
|
51
|
+
[$lastDeleted](./picoflow.flowmap._lastdeleted.md)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
</td><td>
|
|
58
|
+
|
|
59
|
+
[FlowState](./picoflow.flowstate.md)<!-- --><{ key?: K; value?: V; }>
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
</td><td>
|
|
63
|
+
|
|
64
|
+
A reactive state that holds the most recent key and value that were deleted.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
</td></tr>
|
|
68
|
+
<tr><td>
|
|
69
|
+
|
|
70
|
+
[$lastSet](./picoflow.flowmap._lastset.md)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
</td><td>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
</td><td>
|
|
77
|
+
|
|
78
|
+
[FlowState](./picoflow.flowstate.md)<!-- --><{ key?: K; value?: V; }>
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
</td><td>
|
|
82
|
+
|
|
83
|
+
A reactive state that holds the most recent key and value that were set.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
</td></tr>
|
|
87
|
+
</tbody></table>
|
|
88
|
+
|
|
89
|
+
## Methods
|
|
90
|
+
|
|
91
|
+
<table><thead><tr><th>
|
|
92
|
+
|
|
93
|
+
Method
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</th><th>
|
|
97
|
+
|
|
98
|
+
Modifiers
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
</th><th>
|
|
102
|
+
|
|
103
|
+
Description
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</th></tr></thead>
|
|
107
|
+
<tbody><tr><td>
|
|
108
|
+
|
|
109
|
+
[delete(key)](./picoflow.flowmap.delete.md)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
</td><td>
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
</td><td>
|
|
116
|
+
|
|
117
|
+
Deletes the value at the specified key from the underlying map.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
</td></tr>
|
|
121
|
+
<tr><td>
|
|
122
|
+
|
|
123
|
+
[setAt(key, value)](./picoflow.flowmap.setat.md)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
</td><td>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</td><td>
|
|
130
|
+
|
|
131
|
+
Sets a value at the specified key in the underlying map.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
</td></tr>
|
|
135
|
+
</tbody></table>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowMap](./picoflow.flowmap.md) > [setAt](./picoflow.flowmap.setat.md)
|
|
4
|
+
|
|
5
|
+
## FlowMap.setAt() method
|
|
6
|
+
|
|
7
|
+
Sets a value at the specified key in the underlying map.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
setAt(key: K, value: V): void;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
key
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
K
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
The key at which to set the value.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
<tr><td>
|
|
50
|
+
|
|
51
|
+
value
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
V
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
The value to set.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td></tr>
|
|
65
|
+
</tbody></table>
|
|
66
|
+
**Returns:**
|
|
67
|
+
|
|
68
|
+
void
|
|
69
|
+
|
|
70
|
+
## Remarks
|
|
71
|
+
|
|
72
|
+
This method updates the internal map with the given key and value, emits the new key-value pair via [FlowMap.$lastSet](./picoflow.flowmap._lastset.md)<!-- -->, and notifies subscribers of the change.
|
|
73
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowObservable](./picoflow.flowobservable.md) > [get](./picoflow.flowobservable.get.md)
|
|
4
|
+
|
|
5
|
+
## FlowObservable.get() method
|
|
6
|
+
|
|
7
|
+
Retrieves the current value of the observable.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
abstract get(): T;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
T
|
|
17
|
+
|
|
18
|
+
The current value.
|
|
19
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowObservable](./picoflow.flowobservable.md)
|
|
4
|
+
|
|
5
|
+
## FlowObservable class
|
|
6
|
+
|
|
7
|
+
Represents a reactive observable that carries a value.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare abstract class FlowObservable<T> extends FlowSignal
|
|
13
|
+
```
|
|
14
|
+
**Extends:** [FlowSignal](./picoflow.flowsignal.md)
|
|
15
|
+
|
|
16
|
+
## Remarks
|
|
17
|
+
|
|
18
|
+
A FlowObservable extends the basic FlowSignal to store a value. Subclasses must implement the abstract [FlowObservable.get()](./picoflow.flowobservable.get.md) method to return the current value.
|
|
19
|
+
|
|
20
|
+
## Methods
|
|
21
|
+
|
|
22
|
+
<table><thead><tr><th>
|
|
23
|
+
|
|
24
|
+
Method
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Modifiers
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th><th>
|
|
33
|
+
|
|
34
|
+
Description
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
</th></tr></thead>
|
|
38
|
+
<tbody><tr><td>
|
|
39
|
+
|
|
40
|
+
[get()](./picoflow.flowobservable.get.md)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
`abstract`
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td><td>
|
|
49
|
+
|
|
50
|
+
Retrieves the current value of the observable.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</td></tr>
|
|
54
|
+
</tbody></table>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowResource](./picoflow.flowresource.md) > [(constructor)](./picoflow.flowresource._constructor_.md)
|
|
4
|
+
|
|
5
|
+
## FlowResource.(constructor)
|
|
6
|
+
|
|
7
|
+
Creates a new FlowResource.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
constructor(fetch: () => Promise<T>, initial: T);
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
fetch
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
() => Promise<T>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
An asynchronous function that retrieves the resource's value.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
<tr><td>
|
|
50
|
+
|
|
51
|
+
initial
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
T
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
The initial value of the resource.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td></tr>
|
|
65
|
+
</tbody></table>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowResource](./picoflow.flowresource.md) > [fetch](./picoflow.flowresource.fetch.md)
|
|
4
|
+
|
|
5
|
+
## FlowResource.fetch() method
|
|
6
|
+
|
|
7
|
+
Asynchronously fetches a new value for the resource.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
fetch(): Promise<void>;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
Promise<void>
|
|
17
|
+
|
|
18
|
+
A Promise that resolves when the fetch operation is complete.
|
|
19
|
+
|
|
20
|
+
## Exceptions
|
|
21
|
+
|
|
22
|
+
Error if the resource is disposed.
|
|
23
|
+
|
|
24
|
+
## Remarks
|
|
25
|
+
|
|
26
|
+
Executes the internal fetch function. If the fetched value differs from the current one, updates the resource's value and notifies subscribers.
|
|
27
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowResource](./picoflow.flowresource.md) > [get](./picoflow.flowresource.get.md)
|
|
4
|
+
|
|
5
|
+
## FlowResource.get() method
|
|
6
|
+
|
|
7
|
+
Retrieves the current resource value.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
get(): T;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
T
|
|
17
|
+
|
|
18
|
+
The current value.
|
|
19
|
+
|
|
20
|
+
## Exceptions
|
|
21
|
+
|
|
22
|
+
Error if the resource is disposed.
|
|
23
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowResource](./picoflow.flowresource.md)
|
|
4
|
+
|
|
5
|
+
## FlowResource class
|
|
6
|
+
|
|
7
|
+
Represents a reactive resource that asynchronously fetches its value.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare class FlowResource<T> extends FlowObservable<T>
|
|
13
|
+
```
|
|
14
|
+
**Extends:** [FlowObservable](./picoflow.flowobservable.md)<!-- --><T>
|
|
15
|
+
|
|
16
|
+
## Remarks
|
|
17
|
+
|
|
18
|
+
A FlowResource extends FlowObservable and encapsulates an asynchronous fetch function. It is used to retrieve and update its value asynchronously. When the fetch is executed, if the new value differs from the current value, the resource is updated and its subscribers are notified.
|
|
19
|
+
|
|
20
|
+
## Constructors
|
|
21
|
+
|
|
22
|
+
<table><thead><tr><th>
|
|
23
|
+
|
|
24
|
+
Constructor
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Modifiers
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th><th>
|
|
33
|
+
|
|
34
|
+
Description
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
</th></tr></thead>
|
|
38
|
+
<tbody><tr><td>
|
|
39
|
+
|
|
40
|
+
[(constructor)(fetch, initial)](./picoflow.flowresource._constructor_.md)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
Creates a new FlowResource.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</td></tr>
|
|
52
|
+
</tbody></table>
|
|
53
|
+
|
|
54
|
+
## Methods
|
|
55
|
+
|
|
56
|
+
<table><thead><tr><th>
|
|
57
|
+
|
|
58
|
+
Method
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
</th><th>
|
|
62
|
+
|
|
63
|
+
Modifiers
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</th><th>
|
|
67
|
+
|
|
68
|
+
Description
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
</th></tr></thead>
|
|
72
|
+
<tbody><tr><td>
|
|
73
|
+
|
|
74
|
+
[fetch()](./picoflow.flowresource.fetch.md)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
</td><td>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
</td><td>
|
|
81
|
+
|
|
82
|
+
Asynchronously fetches a new value for the resource.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</td></tr>
|
|
86
|
+
<tr><td>
|
|
87
|
+
|
|
88
|
+
[get()](./picoflow.flowresource.get.md)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
</td><td>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
</td><td>
|
|
95
|
+
|
|
96
|
+
Retrieves the current resource value.
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
</td></tr>
|
|
100
|
+
</tbody></table>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowSetter](./picoflow.flowsetter.md)
|
|
4
|
+
|
|
5
|
+
## FlowSetter type
|
|
6
|
+
|
|
7
|
+
A function that sets a new value.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export type FlowSetter<T> = (value: T) => void;
|
|
13
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowSignal](./picoflow.flowsignal.md) > [dispose](./picoflow.flowsignal.dispose.md)
|
|
4
|
+
|
|
5
|
+
## FlowSignal.dispose() method
|
|
6
|
+
|
|
7
|
+
Disposes the signal.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
dispose(): void;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
void
|
|
17
|
+
|
|
18
|
+
## Exceptions
|
|
19
|
+
|
|
20
|
+
Error if the signal is already disposed.
|
|
21
|
+
|
|
22
|
+
## Remarks
|
|
23
|
+
|
|
24
|
+
Disposing a signal will dispose all registered effects and listeners, and unregister all dependencies. Once disposed, any further calls to the signal will throw an error.
|
|
25
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [picoflow](./picoflow.md) > [FlowSignal](./picoflow.flowsignal.md) > [disposed](./picoflow.flowsignal.disposed.md)
|
|
4
|
+
|
|
5
|
+
## FlowSignal.disposed property
|
|
6
|
+
|
|
7
|
+
Indicates whether the signal has been disposed.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
get disposed(): boolean;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Remarks
|
|
16
|
+
|
|
17
|
+
Once disposed, the signal should not be used.
|
|
18
|
+
|