@but212/atom-effect 0.22.1 → 0.23.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/dist/atom-effect.min.js +1 -1
- package/dist/atom-effect.min.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -29
- package/dist/index.mjs +429 -340
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -21,12 +21,6 @@ export declare type AsyncStateType = (typeof AsyncState)[keyof typeof AsyncState
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function atom<T>(initialValue: T, options?: AtomOptions): WritableAtom<T>;
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Brand symbols for reliable type identification.
|
|
26
|
-
* Prevents false positives from duck-typing with external objects.
|
|
27
|
-
*/
|
|
28
|
-
export declare const ATOM_BRAND: unique symbol;
|
|
29
|
-
|
|
30
24
|
/**
|
|
31
25
|
* Base error class.
|
|
32
26
|
*/
|
|
@@ -63,8 +57,6 @@ export declare function computed<T>(fn: () => Promise<T>, options: ComputedOptio
|
|
|
63
57
|
defaultValue: T;
|
|
64
58
|
}): ComputedAtom<T>;
|
|
65
59
|
|
|
66
|
-
export declare const COMPUTED_BRAND: unique symbol;
|
|
67
|
-
|
|
68
60
|
/**
|
|
69
61
|
* Computed atom interface.
|
|
70
62
|
*/
|
|
@@ -120,7 +112,6 @@ export declare interface DebugConfig {
|
|
|
120
112
|
enabled: boolean;
|
|
121
113
|
warnInfiniteLoop: boolean;
|
|
122
114
|
warn(condition: boolean, message: string): void;
|
|
123
|
-
checkCircular(dep: Dependency, current: object): void;
|
|
124
115
|
attachDebugInfo(obj: object, type: string, id: number): void;
|
|
125
116
|
getDebugName(obj: object | null | undefined): string | undefined;
|
|
126
117
|
getDebugType(obj: object | null | undefined): string | undefined;
|
|
@@ -128,20 +119,22 @@ export declare interface DebugConfig {
|
|
|
128
119
|
|
|
129
120
|
/**
|
|
130
121
|
* Dependency interface.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* Internal fields (`version`, `flags`, `_lastSeenEpoch`) are part of the
|
|
125
|
+
* engine contract between reactive nodes and must not be mutated externally.
|
|
131
126
|
*/
|
|
132
127
|
export declare interface Dependency {
|
|
133
128
|
readonly id: DependencyId;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
flags: number;
|
|
138
|
-
/** Last validated epoch. */
|
|
139
|
-
_lastSeenEpoch: number;
|
|
129
|
+
/* Excluded from this release type: version */
|
|
130
|
+
/* Excluded from this release type: flags */
|
|
131
|
+
/* Excluded from this release type: _lastSeenEpoch */
|
|
140
132
|
/**
|
|
141
133
|
* Adds a subscriber to this dependency.
|
|
142
|
-
*
|
|
134
|
+
* The listener may optionally receive the new and previous values.
|
|
135
|
+
* @param listener - A callback or Subscriber object.
|
|
143
136
|
*/
|
|
144
|
-
subscribe(listener: (() => void) | Subscriber): () => void;
|
|
137
|
+
subscribe(listener: ((newValue?: unknown, oldValue?: unknown) => void) | Subscriber): () => void;
|
|
145
138
|
/** Peek hook. */
|
|
146
139
|
peek?(): unknown;
|
|
147
140
|
/** Value accessor. */
|
|
@@ -162,8 +155,6 @@ export declare type DependencyId = number;
|
|
|
162
155
|
*/
|
|
163
156
|
export declare function effect(fn: EffectFunction, options?: EffectOptions): EffectObject;
|
|
164
157
|
|
|
165
|
-
export declare const EFFECT_BRAND: unique symbol;
|
|
166
|
-
|
|
167
158
|
/** Effect error. */
|
|
168
159
|
export declare class EffectError extends AtomError {
|
|
169
160
|
constructor(message: string, cause?: Error | null);
|
|
@@ -183,6 +174,7 @@ export declare interface EffectObject extends Disposable {
|
|
|
183
174
|
}
|
|
184
175
|
|
|
185
176
|
export declare interface EffectOptions {
|
|
177
|
+
name?: string;
|
|
186
178
|
sync?: boolean;
|
|
187
179
|
maxExecutionsPerSecond?: number;
|
|
188
180
|
maxExecutionsPerFlush?: number;
|
|
@@ -206,15 +198,6 @@ export declare function isComputed(obj: unknown): obj is ComputedAtom;
|
|
|
206
198
|
*/
|
|
207
199
|
export declare function isEffect(obj: unknown): obj is EffectObject;
|
|
208
200
|
|
|
209
|
-
/**
|
|
210
|
-
* Array pool configuration.
|
|
211
|
-
*/
|
|
212
|
-
export declare const POOL_CONFIG: {
|
|
213
|
-
readonly MAX_SIZE: 1000;
|
|
214
|
-
readonly WARMUP_SIZE: 100;
|
|
215
|
-
readonly ENABLE_STATS: false;
|
|
216
|
-
};
|
|
217
|
-
|
|
218
201
|
export declare interface PoolStats {
|
|
219
202
|
acquired: number;
|
|
220
203
|
released: number;
|
|
@@ -317,12 +300,20 @@ export declare class SchedulerError extends AtomError {
|
|
|
317
300
|
constructor(message: string, cause?: Error | null);
|
|
318
301
|
}
|
|
319
302
|
|
|
320
|
-
declare
|
|
303
|
+
declare type SchedulerJob = SchedulerJobFunction | SchedulerJobObject;
|
|
304
|
+
|
|
305
|
+
declare interface SchedulerJobFunction {
|
|
321
306
|
(): void;
|
|
322
307
|
/** Next scheduled epoch */
|
|
323
308
|
_nextEpoch?: number;
|
|
324
309
|
}
|
|
325
310
|
|
|
311
|
+
declare interface SchedulerJobObject {
|
|
312
|
+
execute(): void;
|
|
313
|
+
/** Next scheduled epoch */
|
|
314
|
+
_nextEpoch?: number;
|
|
315
|
+
}
|
|
316
|
+
|
|
326
317
|
declare enum SchedulerPhase {
|
|
327
318
|
IDLE = 0,
|
|
328
319
|
BATCHING = 1,
|