aoye 0.0.47 → 0.0.49
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 +25 -1
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +24 -2
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.umd.js +25 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/aoye.esm.js
CHANGED
|
@@ -715,6 +715,19 @@ class Scope {
|
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
|
+
class NoopEffect {
|
|
719
|
+
constructor(callback) {
|
|
720
|
+
this.callback = callback;
|
|
721
|
+
const scope = new Scope(callback);
|
|
722
|
+
scope.get();
|
|
723
|
+
return scope;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
const noopEffect = callback => {
|
|
727
|
+
const scope = new Scope(callback);
|
|
728
|
+
scope.get();
|
|
729
|
+
return scope;
|
|
730
|
+
};
|
|
718
731
|
Scope.prototype.dispose = dispose;
|
|
719
732
|
|
|
720
733
|
const rawToProxy = new WeakMap();
|
|
@@ -1260,6 +1273,10 @@ function $(data) {
|
|
|
1260
1273
|
};
|
|
1261
1274
|
}
|
|
1262
1275
|
}
|
|
1276
|
+
const DefaultCustomEffectOpt = {
|
|
1277
|
+
immediate: true,
|
|
1278
|
+
type: 'sync'
|
|
1279
|
+
};
|
|
1263
1280
|
function effectUt(callback, depOrOpt, opt) {
|
|
1264
1281
|
const hasDep = Array.isArray(depOrOpt);
|
|
1265
1282
|
opt = hasDep ? opt || {} : depOrOpt || {};
|
|
@@ -1299,6 +1316,10 @@ function effectUt(callback, depOrOpt, opt) {
|
|
|
1299
1316
|
function effect(callback, depOrOpt, opt) {
|
|
1300
1317
|
const hasDep = Array.isArray(depOrOpt);
|
|
1301
1318
|
opt = hasDep ? opt || {} : depOrOpt || {};
|
|
1319
|
+
opt = {
|
|
1320
|
+
...DefaultCustomEffectOpt,
|
|
1321
|
+
...opt
|
|
1322
|
+
};
|
|
1302
1323
|
const scheduleType = EffectStrType2Enum[opt.type];
|
|
1303
1324
|
if (!hasDep) {
|
|
1304
1325
|
const ef = new Effect(callback, scheduleType);
|
|
@@ -1315,7 +1336,8 @@ function effect(callback, depOrOpt, opt) {
|
|
|
1315
1336
|
}));
|
|
1316
1337
|
const ef = new Effect(eff => {
|
|
1317
1338
|
for (let i = 0; i < deps.length; i++) {
|
|
1318
|
-
const
|
|
1339
|
+
const dep = deps[i];
|
|
1340
|
+
const value = typeof dep === 'function' ? dep() : dep.get();
|
|
1319
1341
|
vs[i].old = vs[i].val;
|
|
1320
1342
|
vs[i].val = value;
|
|
1321
1343
|
}
|
|
@@ -1339,5 +1361,5 @@ function scope(...args) {
|
|
|
1339
1361
|
return run;
|
|
1340
1362
|
}
|
|
1341
1363
|
|
|
1342
|
-
export { $, Computed, Effect, EffectStrType2Enum, IsStore, Keys, ScheduleStatus, ScheduleType, Scope, Signal, Store, StoreIgnoreKeys, batchEnd, batchStart, clean, deepSignal, effect, effectUt, execId, execIdInc, getPulling, ide, macro, micro, now, runWithPulling, scope, setExecId, setPulling, shareSignal, toRaw };
|
|
1364
|
+
export { $, Computed, Effect, EffectStrType2Enum, IsStore, Keys, NoopEffect, ScheduleStatus, ScheduleType, Scope, Signal, Store, StoreIgnoreKeys, batchEnd, batchStart, clean, deepSignal, effect, effectUt, execId, execIdInc, getPulling, ide, macro, micro, noopEffect, now, runWithPulling, scope, setExecId, setPulling, shareSignal, toRaw };
|
|
1343
1365
|
//# sourceMappingURL=aoye.esm.js.map
|