aoye 0.0.58 → 0.0.59
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/aoye.cjs.js +13 -2
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +13 -2
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.umd.js +13 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/aoye.cjs.js
CHANGED
|
@@ -733,14 +733,25 @@ class Scope {
|
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
735
|
class NoopEffect {
|
|
736
|
-
constructor(callback) {
|
|
736
|
+
constructor(callback, _type) {
|
|
737
737
|
this.callback = callback;
|
|
738
738
|
const scope = new Scope(callback);
|
|
739
739
|
scope.get();
|
|
740
740
|
return scope;
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
|
-
const noopEffect = callback => {
|
|
743
|
+
const noopEffect = (callback, deps, _opt) => {
|
|
744
|
+
if (deps && deps.length > 0) {
|
|
745
|
+
const scope = new Scope(() => {
|
|
746
|
+
const vs = deps.map(d => ({
|
|
747
|
+
old: undefined,
|
|
748
|
+
val: typeof d === 'function' ? d() : d.get()
|
|
749
|
+
}));
|
|
750
|
+
callback(...vs);
|
|
751
|
+
});
|
|
752
|
+
scope.get();
|
|
753
|
+
return scope;
|
|
754
|
+
}
|
|
744
755
|
const scope = new Scope(callback);
|
|
745
756
|
scope.get();
|
|
746
757
|
return scope;
|