aoye 0.0.45 → 0.0.47
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 -8
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +24 -9
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.umd.js +25 -8
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/aoye.esm.js
CHANGED
|
@@ -23,6 +23,18 @@ let ScheduleType = function (ScheduleType) {
|
|
|
23
23
|
ScheduleType[ScheduleType["Post"] = 8] = "Post";
|
|
24
24
|
return ScheduleType;
|
|
25
25
|
}({});
|
|
26
|
+
const EffectStrType2Enum = {
|
|
27
|
+
sync: ScheduleType.Sync,
|
|
28
|
+
pre: ScheduleType.Pre,
|
|
29
|
+
render: ScheduleType.Render,
|
|
30
|
+
post: ScheduleType.Post
|
|
31
|
+
};
|
|
32
|
+
let ScheduleStatus = function (ScheduleStatus) {
|
|
33
|
+
ScheduleStatus[ScheduleStatus["Idle"] = 0] = "Idle";
|
|
34
|
+
ScheduleStatus[ScheduleStatus["Ready"] = 1] = "Ready";
|
|
35
|
+
ScheduleStatus[ScheduleStatus["Running"] = 2] = "Running";
|
|
36
|
+
return ScheduleStatus;
|
|
37
|
+
}({});
|
|
26
38
|
|
|
27
39
|
class MultiScheduler {
|
|
28
40
|
hasTask = 0;
|
|
@@ -274,10 +286,14 @@ function flushSyncEffect() {
|
|
|
274
286
|
consumeI = -1;
|
|
275
287
|
produceI = -1;
|
|
276
288
|
}
|
|
289
|
+
let schedulerStatus = ScheduleStatus.Idle;
|
|
277
290
|
function flushMicroEffect() {
|
|
278
|
-
if (multiScheduler.hasTask) {
|
|
291
|
+
if (schedulerStatus === ScheduleStatus.Idle && multiScheduler.hasTask) {
|
|
292
|
+
schedulerStatus = ScheduleStatus.Ready;
|
|
279
293
|
micro(() => {
|
|
294
|
+
schedulerStatus = ScheduleStatus.Running;
|
|
280
295
|
multiScheduler.flushAllTask();
|
|
296
|
+
schedulerStatus = ScheduleStatus.Idle;
|
|
281
297
|
});
|
|
282
298
|
}
|
|
283
299
|
}
|
|
@@ -1244,14 +1260,12 @@ function $(data) {
|
|
|
1244
1260
|
};
|
|
1245
1261
|
}
|
|
1246
1262
|
}
|
|
1247
|
-
({
|
|
1248
|
-
type: ScheduleType.Sync
|
|
1249
|
-
});
|
|
1250
1263
|
function effectUt(callback, depOrOpt, opt) {
|
|
1251
1264
|
const hasDep = Array.isArray(depOrOpt);
|
|
1252
1265
|
opt = hasDep ? opt || {} : depOrOpt || {};
|
|
1266
|
+
const scheduleType = EffectStrType2Enum[opt.type];
|
|
1253
1267
|
if (!hasDep) {
|
|
1254
|
-
const ef = new Effect(callback,
|
|
1268
|
+
const ef = new Effect(callback, scheduleType);
|
|
1255
1269
|
const run = ef.dispose.bind(ef);
|
|
1256
1270
|
run.ins = ef;
|
|
1257
1271
|
return run;
|
|
@@ -1277,7 +1291,7 @@ function effectUt(callback, depOrOpt, opt) {
|
|
|
1277
1291
|
eff.state &= -257;
|
|
1278
1292
|
}
|
|
1279
1293
|
mounted = true;
|
|
1280
|
-
},
|
|
1294
|
+
}, scheduleType);
|
|
1281
1295
|
const run = ef.dispose.bind(ef);
|
|
1282
1296
|
run.ins = ef;
|
|
1283
1297
|
return run;
|
|
@@ -1285,8 +1299,9 @@ function effectUt(callback, depOrOpt, opt) {
|
|
|
1285
1299
|
function effect(callback, depOrOpt, opt) {
|
|
1286
1300
|
const hasDep = Array.isArray(depOrOpt);
|
|
1287
1301
|
opt = hasDep ? opt || {} : depOrOpt || {};
|
|
1302
|
+
const scheduleType = EffectStrType2Enum[opt.type];
|
|
1288
1303
|
if (!hasDep) {
|
|
1289
|
-
const ef = new Effect(callback,
|
|
1304
|
+
const ef = new Effect(callback, scheduleType);
|
|
1290
1305
|
return ef;
|
|
1291
1306
|
}
|
|
1292
1307
|
let mounted = false;
|
|
@@ -1310,7 +1325,7 @@ function effect(callback, depOrOpt, opt) {
|
|
|
1310
1325
|
eff.state &= -257;
|
|
1311
1326
|
}
|
|
1312
1327
|
mounted = true;
|
|
1313
|
-
},
|
|
1328
|
+
}, scheduleType);
|
|
1314
1329
|
return ef;
|
|
1315
1330
|
}
|
|
1316
1331
|
function scope(...args) {
|
|
@@ -1324,5 +1339,5 @@ function scope(...args) {
|
|
|
1324
1339
|
return run;
|
|
1325
1340
|
}
|
|
1326
1341
|
|
|
1327
|
-
export { $, Computed, Effect, IsStore, Keys, ScheduleType, Scope, Signal, Store, StoreIgnoreKeys, batchEnd, batchStart, clean, deepSignal, effect, effectUt, execId, execIdInc, getPulling, ide, macro, micro, now, runWithPulling, scope, setExecId, setPulling, shareSignal, toRaw };
|
|
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 };
|
|
1328
1343
|
//# sourceMappingURL=aoye.esm.js.map
|