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