aoye 0.0.46 → 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/index.umd.js CHANGED
@@ -27,6 +27,12 @@
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
+ };
30
36
  let ScheduleStatus = function (ScheduleStatus) {
31
37
  ScheduleStatus[ScheduleStatus["Idle"] = 0] = "Idle";
32
38
  ScheduleStatus[ScheduleStatus["Ready"] = 1] = "Ready";
@@ -1258,14 +1264,12 @@
1258
1264
  };
1259
1265
  }
1260
1266
  }
1261
- ({
1262
- type: ScheduleType.Sync
1263
- });
1264
1267
  function effectUt(callback, depOrOpt, opt) {
1265
1268
  const hasDep = Array.isArray(depOrOpt);
1266
1269
  opt = hasDep ? opt || {} : depOrOpt || {};
1270
+ const scheduleType = EffectStrType2Enum[opt.type];
1267
1271
  if (!hasDep) {
1268
- const ef = new Effect(callback, opt.type);
1272
+ const ef = new Effect(callback, scheduleType);
1269
1273
  const run = ef.dispose.bind(ef);
1270
1274
  run.ins = ef;
1271
1275
  return run;
@@ -1291,7 +1295,7 @@
1291
1295
  eff.state &= -257;
1292
1296
  }
1293
1297
  mounted = true;
1294
- }, opt.type);
1298
+ }, scheduleType);
1295
1299
  const run = ef.dispose.bind(ef);
1296
1300
  run.ins = ef;
1297
1301
  return run;
@@ -1299,8 +1303,9 @@
1299
1303
  function effect(callback, depOrOpt, opt) {
1300
1304
  const hasDep = Array.isArray(depOrOpt);
1301
1305
  opt = hasDep ? opt || {} : depOrOpt || {};
1306
+ const scheduleType = EffectStrType2Enum[opt.type];
1302
1307
  if (!hasDep) {
1303
- const ef = new Effect(callback, opt.type);
1308
+ const ef = new Effect(callback, scheduleType);
1304
1309
  return ef;
1305
1310
  }
1306
1311
  let mounted = false;
@@ -1324,7 +1329,7 @@
1324
1329
  eff.state &= -257;
1325
1330
  }
1326
1331
  mounted = true;
1327
- }, opt.type);
1332
+ }, scheduleType);
1328
1333
  return ef;
1329
1334
  }
1330
1335
  function scope(...args) {
@@ -1341,6 +1346,7 @@
1341
1346
  exports.$ = $;
1342
1347
  exports.Computed = Computed;
1343
1348
  exports.Effect = Effect;
1349
+ exports.EffectStrType2Enum = EffectStrType2Enum;
1344
1350
  exports.IsStore = IsStore;
1345
1351
  exports.Keys = Keys;
1346
1352
  exports.ScheduleStatus = ScheduleStatus;