async-reactivity 2.0.22 → 2.0.24
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 +44 -0
- package/lib/computed.js +24 -18
- package/lib/computed.test.js +16 -0
- package/lib/tracker.js +1 -1
- package/lib/watcher.js +1 -0
- package/lib/watcher.test.js +20 -0
- package/package.json +1 -1
- package/src/computed.test.ts +18 -0
- package/src/computed.ts +28 -22
- package/src/deferrer.ts +2 -2
- package/src/dependency.ts +1 -1
- package/src/dependent.ts +2 -2
- package/src/tracker.ts +1 -1
- package/src/watcher.test.ts +25 -0
- package/src/watcher.ts +1 -0
- package/types/computed.d.ts +3 -3
- package/types/computed.d.ts.map +1 -1
- package/types/deferrer.d.ts +1 -1
- package/types/deferrer.d.ts.map +1 -1
- package/types/dependency.d.ts +1 -1
- package/types/dependency.d.ts.map +1 -1
- package/types/dependent.d.ts +2 -2
- package/types/dependent.d.ts.map +1 -1
- package/types/watcher.d.ts.map +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Purpose
|
|
2
|
+
|
|
3
|
+
This library is inspired by Vue.js implementation of reactivity. You can familiarize with the concept of reactivity [here](https://vuejs.org/guide/extras/reactivity-in-depth.html). Short excerpt:
|
|
4
|
+
|
|
5
|
+
> Reactivity is a programming paradigm that allows us to adjust to changes in a declarative manner.
|
|
6
|
+
|
|
7
|
+
However Vue.js reactivity is limited to synchronous computation. This library solves this limitation and supports both - synchronous and asynchronous computation.
|
|
8
|
+
|
|
9
|
+
You can familiarize with sample use [here](https://github.com/donatas-luciunas/async-reactivity-sample).
|
|
10
|
+
|
|
11
|
+
# Concepts
|
|
12
|
+
|
|
13
|
+
We refer to values of many variables as "state".
|
|
14
|
+
|
|
15
|
+
We refer to values of many reactive variables as "reactive state".
|
|
16
|
+
|
|
17
|
+
For **reactive state** to be **reactive** dependencies need to be tracked. So it is easier to think about reactive state as a dependency graph (for example A → B → C). Here A → B means:
|
|
18
|
+
* A depends on B
|
|
19
|
+
* B is [dependency](./src/dependency.ts)
|
|
20
|
+
* A is [dependent](./src/dependent.ts)
|
|
21
|
+
|
|
22
|
+
There are few types of reactive variables:
|
|
23
|
+
|
|
24
|
+
* [ref](./src/ref.ts)
|
|
25
|
+
* simply stores a given value (Vue.js `shallowRef` equivalent)
|
|
26
|
+
* can only be dependency (only incoming arrows)
|
|
27
|
+
* [computed](./src/computed.ts)
|
|
28
|
+
* defined by pure function (Vue.js `computed` equivalent)
|
|
29
|
+
* can be both - dependent and dependency (incoming and outgoing arrows)
|
|
30
|
+
|
|
31
|
+
To integrate state with reactive state you can use:
|
|
32
|
+
* [listener](./src/listener.ts)
|
|
33
|
+
* inherits `ref`
|
|
34
|
+
* can only be dependency (only incoming arrows)
|
|
35
|
+
* `start` function is called when listener gets first dependent
|
|
36
|
+
* it ensures value is updated
|
|
37
|
+
* `stop` function is called when listener loses last dependent
|
|
38
|
+
* [watcher](./src/watcher.ts)
|
|
39
|
+
* a function that is called when dependency changes
|
|
40
|
+
* can only be dependent (only outgoing arrows)
|
|
41
|
+
|
|
42
|
+
# Behavior
|
|
43
|
+
|
|
44
|
+
You can familiarize with behavior by reading tests.
|
package/lib/computed.js
CHANGED
|
@@ -15,7 +15,7 @@ export default class Computed extends Tracker {
|
|
|
15
15
|
getter;
|
|
16
16
|
isEqual;
|
|
17
17
|
state = ComputedState.Invalid;
|
|
18
|
-
dependencies = new Map();
|
|
18
|
+
dependencies = new Map(); // boolean indicates whether value is up to date in regards to the dependency (false - up to date, true - needs update)
|
|
19
19
|
computePromise;
|
|
20
20
|
computePromiseActions;
|
|
21
21
|
lastComputeAttemptPromise;
|
|
@@ -50,21 +50,14 @@ export default class Computed extends Tracker {
|
|
|
50
50
|
}
|
|
51
51
|
compute() {
|
|
52
52
|
if (this.state === ComputedState.Uncertain) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (d instanceof Computed) {
|
|
58
|
-
if (d.state === ComputedState.Valid) {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
else if (d.state === ComputedState.Uncertain) {
|
|
62
|
-
d.value;
|
|
63
|
-
return !this.dependencies.get(d);
|
|
64
|
-
}
|
|
53
|
+
const upToDate = ![...this.dependencies.entries()].some(([d, needsUpdate]) => {
|
|
54
|
+
if (needsUpdate && d instanceof Computed && d.state === ComputedState.Uncertain) {
|
|
55
|
+
d.value;
|
|
56
|
+
return this.dependencies.get(d);
|
|
65
57
|
}
|
|
66
|
-
return
|
|
67
|
-
})
|
|
58
|
+
return needsUpdate;
|
|
59
|
+
});
|
|
60
|
+
if (upToDate) {
|
|
68
61
|
this.finalizeComputing();
|
|
69
62
|
this.validateDependents();
|
|
70
63
|
return this._value;
|
|
@@ -113,10 +106,13 @@ export default class Computed extends Tracker {
|
|
|
113
106
|
}
|
|
114
107
|
}
|
|
115
108
|
innerTrackDependency(dependency) {
|
|
109
|
+
if (dependency === undefined) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
116
112
|
if (this.dependents.has(dependency)) {
|
|
117
113
|
throw new CircularDependencyError();
|
|
118
114
|
}
|
|
119
|
-
this.dependencies.set(dependency,
|
|
115
|
+
this.dependencies.set(dependency, false);
|
|
120
116
|
dependency.addDependent(this);
|
|
121
117
|
return dependency.value;
|
|
122
118
|
}
|
|
@@ -127,19 +123,29 @@ export default class Computed extends Tracker {
|
|
|
127
123
|
this.abortController = undefined;
|
|
128
124
|
this.prepareComputePromise();
|
|
129
125
|
}
|
|
130
|
-
invalidate() {
|
|
126
|
+
invalidate(dependency) {
|
|
131
127
|
if (this.state === ComputedState.Computing) {
|
|
132
128
|
this.lastComputeAttemptPromise = undefined; // prevent finalizeComputing if it is in the event loop already
|
|
133
129
|
Promise.resolve().then(this.compute.bind(this));
|
|
134
130
|
}
|
|
135
131
|
else if (this.state === ComputedState.Valid) {
|
|
136
132
|
this.state = ComputedState.Uncertain;
|
|
133
|
+
if (dependency) {
|
|
134
|
+
this.dependencies.set(dependency, true);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
for (const dep of this.dependencies.keys()) {
|
|
138
|
+
this.dependencies.set(dep, true);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
137
141
|
super.invalidate();
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
forceInvalidate() {
|
|
141
145
|
this.invalidate();
|
|
142
|
-
this.state
|
|
146
|
+
if (this.state !== ComputedState.Computing) {
|
|
147
|
+
this.state = ComputedState.Invalid;
|
|
148
|
+
}
|
|
143
149
|
}
|
|
144
150
|
validate(dependency) {
|
|
145
151
|
this.dependencies.set(dependency, false);
|
package/lib/computed.test.js
CHANGED
|
@@ -130,6 +130,22 @@ describe('computed', function () {
|
|
|
130
130
|
assert.strictEqual(c.value, 6);
|
|
131
131
|
assert.strictEqual(gate, 2);
|
|
132
132
|
});
|
|
133
|
+
it('compute and abort when forced', async function () {
|
|
134
|
+
let gate = 0;
|
|
135
|
+
const b = new Computed(async (_value, _previousValue, abortSignal) => {
|
|
136
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
137
|
+
if (abortSignal.aborted) {
|
|
138
|
+
gate++;
|
|
139
|
+
throw new Error();
|
|
140
|
+
}
|
|
141
|
+
return 5;
|
|
142
|
+
});
|
|
143
|
+
const v = b.value;
|
|
144
|
+
await new Promise(resolve => setTimeout(resolve, 5));
|
|
145
|
+
b.forceInvalidate();
|
|
146
|
+
assert.strictEqual(await v, 5);
|
|
147
|
+
assert.strictEqual(gate, 1);
|
|
148
|
+
});
|
|
133
149
|
it('isEqual', function () {
|
|
134
150
|
const a = new Ref(1);
|
|
135
151
|
const b = new Computed((value) => {
|
package/lib/tracker.js
CHANGED
package/lib/watcher.js
CHANGED
package/lib/watcher.test.js
CHANGED
|
@@ -74,4 +74,24 @@ describe('watcher', function () {
|
|
|
74
74
|
assert.strictEqual(computedGate, 3);
|
|
75
75
|
assert.strictEqual(watcherGate, 2);
|
|
76
76
|
});
|
|
77
|
+
it('parallel compute', async function () {
|
|
78
|
+
const r = new Ref(5);
|
|
79
|
+
const c = new Computed((value) => value(r) + 1);
|
|
80
|
+
const c1 = new Computed((value) => value(c) + 1);
|
|
81
|
+
const c2 = new Computed((value) => value(c) + 2);
|
|
82
|
+
let gate1 = 0, gate2 = 0;
|
|
83
|
+
new Watcher(c1, () => {
|
|
84
|
+
gate1++;
|
|
85
|
+
});
|
|
86
|
+
new Watcher(c2, () => {
|
|
87
|
+
gate2++;
|
|
88
|
+
});
|
|
89
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
90
|
+
r.value = 6;
|
|
91
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
92
|
+
r.value = 7;
|
|
93
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
94
|
+
assert.strictEqual(gate1, 3);
|
|
95
|
+
assert.strictEqual(gate2, 3);
|
|
96
|
+
});
|
|
77
97
|
});
|
package/package.json
CHANGED
package/src/computed.test.ts
CHANGED
|
@@ -153,6 +153,24 @@ describe('computed', function () {
|
|
|
153
153
|
assert.strictEqual(gate, 2);
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
+
it('compute and abort when forced', async function () {
|
|
157
|
+
let gate = 0;
|
|
158
|
+
const b = new Computed(async (_value, _previousValue, abortSignal) => {
|
|
159
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
160
|
+
if (abortSignal.aborted) {
|
|
161
|
+
gate++;
|
|
162
|
+
throw new Error();
|
|
163
|
+
}
|
|
164
|
+
return 5;
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const v = b.value;
|
|
168
|
+
await new Promise(resolve => setTimeout(resolve, 5));
|
|
169
|
+
b.forceInvalidate();
|
|
170
|
+
assert.strictEqual(await v, 5);
|
|
171
|
+
assert.strictEqual(gate, 1);
|
|
172
|
+
});
|
|
173
|
+
|
|
156
174
|
it('isEqual', function() {
|
|
157
175
|
const a = new Ref(1);
|
|
158
176
|
const b = new Computed((value) => {
|
package/src/computed.ts
CHANGED
|
@@ -5,7 +5,7 @@ import defaultIsEqual from "./defaultIsEqual.js";
|
|
|
5
5
|
import { Deferrer } from "./deferrer.js";
|
|
6
6
|
import { debounce } from 'lodash-es';
|
|
7
7
|
|
|
8
|
-
export declare type TrackValue = <T>(dependency: Dependency<T>) => T;
|
|
8
|
+
export declare type TrackValue = (<T>(dependency: Dependency<T>) => T) & (<T>(dependency: Dependency<T> | undefined) => T | undefined);
|
|
9
9
|
export declare type ComputeFunc<T> = (value: TrackValue, previousValue: T | undefined, abortSignal: AbortSignal) => T;
|
|
10
10
|
export declare type ComputeFuncScoped<T1, T2> = (value: TrackValue, scope: T1, previousValue: T2 | undefined, abortSignal: AbortSignal) => T2;
|
|
11
11
|
|
|
@@ -22,8 +22,8 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
|
|
|
22
22
|
getter: ComputeFunc<T>;
|
|
23
23
|
isEqual: typeof defaultIsEqual<T>;
|
|
24
24
|
private state = ComputedState.Invalid;
|
|
25
|
-
private dependencies = new Map<Dependency<
|
|
26
|
-
private computePromise?: Promise<
|
|
25
|
+
private dependencies = new Map<Dependency<unknown>, boolean>(); // boolean indicates whether value is up to date in regards to the dependency (false - up to date, true - needs update)
|
|
26
|
+
private computePromise?: Promise<unknown>;
|
|
27
27
|
private computePromiseActions?: { resolve: Function, reject: Function };
|
|
28
28
|
private lastComputeAttemptPromise?: Promise<void>;
|
|
29
29
|
private deferrer?: Deferrer;
|
|
@@ -63,20 +63,14 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
|
|
|
63
63
|
|
|
64
64
|
private compute() {
|
|
65
65
|
if (this.state === ComputedState.Uncertain) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (d instanceof Computed) {
|
|
71
|
-
if (d.state === ComputedState.Valid) {
|
|
72
|
-
return true;
|
|
73
|
-
} else if (d.state === ComputedState.Uncertain) {
|
|
74
|
-
d.value;
|
|
75
|
-
return !this.dependencies.get(d);
|
|
76
|
-
}
|
|
66
|
+
const upToDate = ![...this.dependencies.entries()].some(([d, needsUpdate]) => {
|
|
67
|
+
if (needsUpdate && d instanceof Computed && d.state === ComputedState.Uncertain) {
|
|
68
|
+
d.value;
|
|
69
|
+
return this.dependencies.get(d);
|
|
77
70
|
}
|
|
78
|
-
return
|
|
79
|
-
})
|
|
71
|
+
return needsUpdate;
|
|
72
|
+
});
|
|
73
|
+
if (upToDate) {
|
|
80
74
|
this.finalizeComputing();
|
|
81
75
|
this.validateDependents();
|
|
82
76
|
return this._value!;
|
|
@@ -127,16 +121,19 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
|
|
|
127
121
|
}
|
|
128
122
|
}
|
|
129
123
|
|
|
130
|
-
private innerTrackDependency(this: Computed<T>, dependency
|
|
124
|
+
private innerTrackDependency(this: Computed<T>, dependency?: Dependency<unknown>) {
|
|
125
|
+
if (dependency === undefined) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
131
128
|
if (this.dependents.has(dependency as any)) {
|
|
132
129
|
throw new CircularDependencyError();
|
|
133
130
|
}
|
|
134
|
-
this.dependencies.set(dependency,
|
|
131
|
+
this.dependencies.set(dependency, false);
|
|
135
132
|
dependency.addDependent(this);
|
|
136
133
|
return dependency.value;
|
|
137
134
|
}
|
|
138
135
|
|
|
139
|
-
private trackDependency = this.innerTrackDependency.bind(this);
|
|
136
|
+
private trackDependency = this.innerTrackDependency.bind(this) as TrackValue;
|
|
140
137
|
|
|
141
138
|
private finalizeComputing() {
|
|
142
139
|
this.state = ComputedState.Valid;
|
|
@@ -145,22 +142,31 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
|
|
|
145
142
|
this.prepareComputePromise();
|
|
146
143
|
}
|
|
147
144
|
|
|
148
|
-
public invalidate() {
|
|
145
|
+
public invalidate(dependency?: Dependency<unknown>) {
|
|
149
146
|
if (this.state === ComputedState.Computing) {
|
|
150
147
|
this.lastComputeAttemptPromise = undefined; // prevent finalizeComputing if it is in the event loop already
|
|
151
148
|
Promise.resolve().then(this.compute.bind(this));
|
|
152
149
|
} else if (this.state === ComputedState.Valid) {
|
|
153
150
|
this.state = ComputedState.Uncertain;
|
|
151
|
+
if (dependency) {
|
|
152
|
+
this.dependencies.set(dependency, true);
|
|
153
|
+
} else {
|
|
154
|
+
for (const dep of this.dependencies.keys()) {
|
|
155
|
+
this.dependencies.set(dep, true);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
154
158
|
super.invalidate();
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
public forceInvalidate() {
|
|
159
163
|
this.invalidate();
|
|
160
|
-
this.state
|
|
164
|
+
if (this.state !== ComputedState.Computing) {
|
|
165
|
+
this.state = ComputedState.Invalid;
|
|
166
|
+
}
|
|
161
167
|
}
|
|
162
168
|
|
|
163
|
-
public validate(dependency: Dependency<
|
|
169
|
+
public validate(dependency: Dependency<unknown>) {
|
|
164
170
|
this.dependencies.set(dependency, false);
|
|
165
171
|
}
|
|
166
172
|
|
package/src/deferrer.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export class Deferrer {
|
|
2
|
-
private lastPromise?: Promise<
|
|
2
|
+
private lastPromise?: Promise<unknown>;
|
|
3
3
|
|
|
4
4
|
constructor(private readonly callback: Function) { }
|
|
5
5
|
|
|
6
|
-
finally(promise: Promise<
|
|
6
|
+
finally(promise: Promise<unknown>) {
|
|
7
7
|
const currentPromise = Promise.all([this.lastPromise, promise])
|
|
8
8
|
.finally(() => {
|
|
9
9
|
if (this.lastPromise === currentPromise) {
|
package/src/dependency.ts
CHANGED
|
@@ -3,5 +3,5 @@ import Dependent from "./dependent.js";
|
|
|
3
3
|
export default interface Dependency<T> {
|
|
4
4
|
get value(): T;
|
|
5
5
|
addDependent(dependent: Dependent): void;
|
|
6
|
-
removeDependent(dependent: Dependent, promise?: Promise<
|
|
6
|
+
removeDependent(dependent: Dependent, promise?: Promise<unknown>): void;
|
|
7
7
|
}
|
package/src/dependent.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Dependency from "./dependency.js";
|
|
2
2
|
|
|
3
3
|
export default interface Dependent {
|
|
4
|
-
invalidate(): void;
|
|
5
|
-
validate(dependency: Dependency<
|
|
4
|
+
invalidate(dependency?: Dependency<unknown>): void;
|
|
5
|
+
validate(dependency: Dependency<unknown>): void;
|
|
6
6
|
dispose(): void;
|
|
7
7
|
}
|
package/src/tracker.ts
CHANGED
package/src/watcher.test.ts
CHANGED
|
@@ -79,4 +79,29 @@ describe('watcher', function () {
|
|
|
79
79
|
assert.strictEqual(computedGate, 3);
|
|
80
80
|
assert.strictEqual(watcherGate, 2);
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
it('parallel compute', async function () {
|
|
84
|
+
const r = new Ref(5);
|
|
85
|
+
const c = new Computed((value) => value(r) + 1);
|
|
86
|
+
const c1 = new Computed((value) => value(c) + 1);
|
|
87
|
+
const c2 = new Computed((value) => value(c) + 2);
|
|
88
|
+
let gate1 = 0, gate2 = 0;
|
|
89
|
+
|
|
90
|
+
new Watcher(c1, () => {
|
|
91
|
+
gate1++;
|
|
92
|
+
});
|
|
93
|
+
new Watcher(c2, () => {
|
|
94
|
+
gate2++;
|
|
95
|
+
});
|
|
96
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
97
|
+
|
|
98
|
+
r.value = 6;
|
|
99
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
100
|
+
|
|
101
|
+
r.value = 7;
|
|
102
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
103
|
+
|
|
104
|
+
assert.strictEqual(gate1, 3);
|
|
105
|
+
assert.strictEqual(gate2, 3);
|
|
106
|
+
});
|
|
82
107
|
});
|
package/src/watcher.ts
CHANGED
package/types/computed.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Dependency from "./dependency.js";
|
|
|
2
2
|
import Dependent from "./dependent.js";
|
|
3
3
|
import Tracker from "./tracker.js";
|
|
4
4
|
import defaultIsEqual from "./defaultIsEqual.js";
|
|
5
|
-
export declare type TrackValue = <T>(dependency: Dependency<T>) => T;
|
|
5
|
+
export declare type TrackValue = (<T>(dependency: Dependency<T>) => T) & (<T>(dependency: Dependency<T> | undefined) => T | undefined);
|
|
6
6
|
export declare type ComputeFunc<T> = (value: TrackValue, previousValue: T | undefined, abortSignal: AbortSignal) => T;
|
|
7
7
|
export declare type ComputeFuncScoped<T1, T2> = (value: TrackValue, scope: T1, previousValue: T2 | undefined, abortSignal: AbortSignal) => T2;
|
|
8
8
|
export default class Computed<T> extends Tracker<T> implements Dependent, Dependency<T> {
|
|
@@ -25,9 +25,9 @@ export default class Computed<T> extends Tracker<T> implements Dependent, Depend
|
|
|
25
25
|
private innerTrackDependency;
|
|
26
26
|
private trackDependency;
|
|
27
27
|
private finalizeComputing;
|
|
28
|
-
invalidate(): void;
|
|
28
|
+
invalidate(dependency?: Dependency<unknown>): void;
|
|
29
29
|
forceInvalidate(): void;
|
|
30
|
-
validate(dependency: Dependency<
|
|
30
|
+
validate(dependency: Dependency<unknown>): void;
|
|
31
31
|
private validateDependents;
|
|
32
32
|
removeDependent(dependent: Dependent, promise?: Promise<void>): void;
|
|
33
33
|
reset(): void;
|
package/types/computed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../src/computed.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAIjD,MAAM,CAAC,OAAO,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"computed.d.ts","sourceRoot":"","sources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AAC,eAAe,CAAC,CAAkB;gBAE9B,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,4BAAoB,EAAE,UAAU,CAAC,EAAE,MAAM;IAepF,OAAO,CAAC,qBAAqB;IAS7B,IAAW,KAAK,IAAI,CAAC,CAMpB;IAED,OAAO,CAAC,OAAO;IAuCf,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,eAAe,CAAsD;IAE7E,OAAO,CAAC,iBAAiB;IAOlB,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC;IAiB3C,eAAe;IAOf,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC;IAI/C,OAAO,CAAC,kBAAkB;IAMnB,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,gBAAoB,GAAG,IAAI;IAKxE,KAAK;IAQL,OAAO;CAGjB"}
|
package/types/deferrer.d.ts
CHANGED
package/types/deferrer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferrer.d.ts","sourceRoot":"","sources":["../src/deferrer.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IAGL,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"deferrer.d.ts","sourceRoot":"","sources":["../src/deferrer.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IAGL,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,WAAW,CAAC,CAAmB;gBAEV,QAAQ,EAAE,QAAQ;IAE/C,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;CAUpC"}
|
package/types/dependency.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import Dependent from "./dependent.js";
|
|
|
2
2
|
export default interface Dependency<T> {
|
|
3
3
|
get value(): T;
|
|
4
4
|
addDependent(dependent: Dependent): void;
|
|
5
|
-
removeDependent(dependent: Dependent, promise?: Promise<
|
|
5
|
+
removeDependent(dependent: Dependent, promise?: Promise<unknown>): void;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=dependency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency.d.ts","sourceRoot":"","sources":["../src/dependency.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC,CAAC;IACjC,IAAI,KAAK,IAAI,CAAC,CAAC;IACf,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACzC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"dependency.d.ts","sourceRoot":"","sources":["../src/dependency.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC,CAAC;IACjC,IAAI,KAAK,IAAI,CAAC,CAAC;IACf,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACzC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CAC3E"}
|
package/types/dependent.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Dependency from "./dependency.js";
|
|
2
2
|
export default interface Dependent {
|
|
3
|
-
invalidate(): void;
|
|
4
|
-
validate(dependency: Dependency<
|
|
3
|
+
invalidate(dependency?: Dependency<unknown>): void;
|
|
4
|
+
validate(dependency: Dependency<unknown>): void;
|
|
5
5
|
dispose(): void;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=dependent.d.ts.map
|
package/types/dependent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependent.d.ts","sourceRoot":"","sources":["../src/dependent.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,OAAO,WAAW,SAAS;IAC9B,UAAU,
|
|
1
|
+
{"version":3,"file":"dependent.d.ts","sourceRoot":"","sources":["../src/dependent.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,OAAO,WAAW,SAAS;IAC9B,UAAU,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACnD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAChD,OAAO,IAAI,IAAI,CAAC;CACnB"}
|
package/types/watcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../src/watcher.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AAOnC,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;AAE3D,MAAM,CAAC,OAAO,OAAO,OAAO,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAE,YAAW,SAAS;IAEnE,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,KAAK,CAAoB;gBAErB,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,SAAS,GAAE,OAAc;IAYpF,UAAU;IAeV,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