@estjs/signals 0.0.17 → 0.0.18-beta.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/dist/signals.d.cts +1 -12
- package/dist/signals.d.ts +1 -12
- package/package.json +2 -2
package/dist/signals.d.cts
CHANGED
|
@@ -1138,7 +1138,7 @@ interface WatchOptions {
|
|
|
1138
1138
|
/**
|
|
1139
1139
|
* When the callback fires relative to the reactive flush cycle.
|
|
1140
1140
|
* - `'post'` (default) — queued on the microtask job queue (essor's historical
|
|
1141
|
-
* behavior).
|
|
1141
|
+
* behavior).
|
|
1142
1142
|
* - `'pre'` — queued before the main job queue.
|
|
1143
1143
|
* - `'sync'` — run synchronously the instant the source changes. Use sparingly:
|
|
1144
1144
|
* a callback that mutates a tracked dependency can recurse.
|
|
@@ -1152,23 +1152,12 @@ type WatchSource<T = any> = T | {
|
|
|
1152
1152
|
} | (() => T);
|
|
1153
1153
|
/**
|
|
1154
1154
|
* Register a cleanup handler that runs right before the next callback invocation
|
|
1155
|
-
* and when the watcher stops. Mirrors Vue's `onCleanup`/`onInvalidate` — use it
|
|
1156
|
-
* to cancel stale async work (timers, fetches, subscriptions).
|
|
1157
1155
|
*/
|
|
1158
1156
|
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1159
1157
|
type WatchCallback<T = any> = (newValue: T, oldValue: T | undefined, onCleanup: OnCleanup) => void;
|
|
1160
1158
|
/**
|
|
1161
1159
|
* Watch one or more reactive data sources and execute callback when sources change.
|
|
1162
1160
|
*
|
|
1163
|
-
* ⚠️ **`oldValue` caveat for object / reactive sources.** For performance,
|
|
1164
|
-
* `watch` does NOT deep-clone the watched value between runs (deep cloning
|
|
1165
|
-
* every tick is prohibitively expensive). The `newValue` and `oldValue` passed
|
|
1166
|
-
* to your callback are therefore the *same reference* whenever the source is a
|
|
1167
|
-
* reactive object, array, Map/Set, or a getter that returns one — i.e.
|
|
1168
|
-
* `newValue === oldValue` and reading `oldValue.foo` yields the already-mutated
|
|
1169
|
-
* value. This differs from Vue, which snapshots primitives but likewise shares
|
|
1170
|
-
* the reference for deep/reactive sources.
|
|
1171
|
-
*
|
|
1172
1161
|
* To capture a previous snapshot for object sources, derive the specific
|
|
1173
1162
|
* primitive you care about in a getter:
|
|
1174
1163
|
*
|
package/dist/signals.d.ts
CHANGED
|
@@ -1138,7 +1138,7 @@ interface WatchOptions {
|
|
|
1138
1138
|
/**
|
|
1139
1139
|
* When the callback fires relative to the reactive flush cycle.
|
|
1140
1140
|
* - `'post'` (default) — queued on the microtask job queue (essor's historical
|
|
1141
|
-
* behavior).
|
|
1141
|
+
* behavior).
|
|
1142
1142
|
* - `'pre'` — queued before the main job queue.
|
|
1143
1143
|
* - `'sync'` — run synchronously the instant the source changes. Use sparingly:
|
|
1144
1144
|
* a callback that mutates a tracked dependency can recurse.
|
|
@@ -1152,23 +1152,12 @@ type WatchSource<T = any> = T | {
|
|
|
1152
1152
|
} | (() => T);
|
|
1153
1153
|
/**
|
|
1154
1154
|
* Register a cleanup handler that runs right before the next callback invocation
|
|
1155
|
-
* and when the watcher stops. Mirrors Vue's `onCleanup`/`onInvalidate` — use it
|
|
1156
|
-
* to cancel stale async work (timers, fetches, subscriptions).
|
|
1157
1155
|
*/
|
|
1158
1156
|
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1159
1157
|
type WatchCallback<T = any> = (newValue: T, oldValue: T | undefined, onCleanup: OnCleanup) => void;
|
|
1160
1158
|
/**
|
|
1161
1159
|
* Watch one or more reactive data sources and execute callback when sources change.
|
|
1162
1160
|
*
|
|
1163
|
-
* ⚠️ **`oldValue` caveat for object / reactive sources.** For performance,
|
|
1164
|
-
* `watch` does NOT deep-clone the watched value between runs (deep cloning
|
|
1165
|
-
* every tick is prohibitively expensive). The `newValue` and `oldValue` passed
|
|
1166
|
-
* to your callback are therefore the *same reference* whenever the source is a
|
|
1167
|
-
* reactive object, array, Map/Set, or a getter that returns one — i.e.
|
|
1168
|
-
* `newValue === oldValue` and reading `oldValue.foo` yields the already-mutated
|
|
1169
|
-
* value. This differs from Vue, which snapshots primitives but likewise shares
|
|
1170
|
-
* the reference for deep/reactive sources.
|
|
1171
|
-
*
|
|
1172
1161
|
* To capture a previous snapshot for object sources, derive the specific
|
|
1173
1162
|
* primitive you care about in a getter:
|
|
1174
1163
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estjs/signals",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"unpkg": "dist/signals.js",
|
|
53
53
|
"jsdelivr": "dist/signals.js",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@estjs/shared": "0.0.
|
|
55
|
+
"@estjs/shared": "0.0.18-beta.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsup && cross-env NODE_ENV=production tsup --clean=false",
|