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/index.umd.js
CHANGED
|
@@ -27,6 +27,18 @@
|
|
|
27
27
|
ScheduleType[ScheduleType["Post"] = 8] = "Post";
|
|
28
28
|
return ScheduleType;
|
|
29
29
|
}({});
|
|
30
|
+
const EffectStrType2Enum = {
|
|
31
|
+
sync: ScheduleType.Sync,
|
|
32
|
+
pre: ScheduleType.Pre,
|
|
33
|
+
render: ScheduleType.Render,
|
|
34
|
+
post: ScheduleType.Post
|
|
35
|
+
};
|
|
36
|
+
let ScheduleStatus = function (ScheduleStatus) {
|
|
37
|
+
ScheduleStatus[ScheduleStatus["Idle"] = 0] = "Idle";
|
|
38
|
+
ScheduleStatus[ScheduleStatus["Ready"] = 1] = "Ready";
|
|
39
|
+
ScheduleStatus[ScheduleStatus["Running"] = 2] = "Running";
|
|
40
|
+
return ScheduleStatus;
|
|
41
|
+
}({});
|
|
30
42
|
|
|
31
43
|
class MultiScheduler {
|
|
32
44
|
hasTask = 0;
|
|
@@ -278,10 +290,14 @@
|
|
|
278
290
|
consumeI = -1;
|
|
279
291
|
produceI = -1;
|
|
280
292
|
}
|
|
293
|
+
let schedulerStatus = ScheduleStatus.Idle;
|
|
281
294
|
function flushMicroEffect() {
|
|
282
|
-
if (multiScheduler.hasTask) {
|
|
295
|
+
if (schedulerStatus === ScheduleStatus.Idle && multiScheduler.hasTask) {
|
|
296
|
+
schedulerStatus = ScheduleStatus.Ready;
|
|
283
297
|
micro(() => {
|
|
298
|
+
schedulerStatus = ScheduleStatus.Running;
|
|
284
299
|
multiScheduler.flushAllTask();
|
|
300
|
+
schedulerStatus = ScheduleStatus.Idle;
|
|
285
301
|
});
|
|
286
302
|
}
|
|
287
303
|
}
|
|
@@ -1248,14 +1264,12 @@
|
|
|
1248
1264
|
};
|
|
1249
1265
|
}
|
|
1250
1266
|
}
|
|
1251
|
-
({
|
|
1252
|
-
type: ScheduleType.Sync
|
|
1253
|
-
});
|
|
1254
1267
|
function effectUt(callback, depOrOpt, opt) {
|
|
1255
1268
|
const hasDep = Array.isArray(depOrOpt);
|
|
1256
1269
|
opt = hasDep ? opt || {} : depOrOpt || {};
|
|
1270
|
+
const scheduleType = EffectStrType2Enum[opt.type];
|
|
1257
1271
|
if (!hasDep) {
|
|
1258
|
-
const ef = new Effect(callback,
|
|
1272
|
+
const ef = new Effect(callback, scheduleType);
|
|
1259
1273
|
const run = ef.dispose.bind(ef);
|
|
1260
1274
|
run.ins = ef;
|
|
1261
1275
|
return run;
|
|
@@ -1281,7 +1295,7 @@
|
|
|
1281
1295
|
eff.state &= -257;
|
|
1282
1296
|
}
|
|
1283
1297
|
mounted = true;
|
|
1284
|
-
},
|
|
1298
|
+
}, scheduleType);
|
|
1285
1299
|
const run = ef.dispose.bind(ef);
|
|
1286
1300
|
run.ins = ef;
|
|
1287
1301
|
return run;
|
|
@@ -1289,8 +1303,9 @@
|
|
|
1289
1303
|
function effect(callback, depOrOpt, opt) {
|
|
1290
1304
|
const hasDep = Array.isArray(depOrOpt);
|
|
1291
1305
|
opt = hasDep ? opt || {} : depOrOpt || {};
|
|
1306
|
+
const scheduleType = EffectStrType2Enum[opt.type];
|
|
1292
1307
|
if (!hasDep) {
|
|
1293
|
-
const ef = new Effect(callback,
|
|
1308
|
+
const ef = new Effect(callback, scheduleType);
|
|
1294
1309
|
return ef;
|
|
1295
1310
|
}
|
|
1296
1311
|
let mounted = false;
|
|
@@ -1314,7 +1329,7 @@
|
|
|
1314
1329
|
eff.state &= -257;
|
|
1315
1330
|
}
|
|
1316
1331
|
mounted = true;
|
|
1317
|
-
},
|
|
1332
|
+
}, scheduleType);
|
|
1318
1333
|
return ef;
|
|
1319
1334
|
}
|
|
1320
1335
|
function scope(...args) {
|
|
@@ -1331,8 +1346,10 @@
|
|
|
1331
1346
|
exports.$ = $;
|
|
1332
1347
|
exports.Computed = Computed;
|
|
1333
1348
|
exports.Effect = Effect;
|
|
1349
|
+
exports.EffectStrType2Enum = EffectStrType2Enum;
|
|
1334
1350
|
exports.IsStore = IsStore;
|
|
1335
1351
|
exports.Keys = Keys;
|
|
1352
|
+
exports.ScheduleStatus = ScheduleStatus;
|
|
1336
1353
|
exports.ScheduleType = ScheduleType;
|
|
1337
1354
|
exports.Scope = Scope;
|
|
1338
1355
|
exports.Signal = Signal;
|