@netless/app-slide 0.2.106-beta.4 → 0.2.106-beta.5

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/main.es.js CHANGED
@@ -38755,23 +38755,35 @@ geometry=${JSON.stringify(o2)}`;
38755
38755
  this.tasks = [], this.isDestroy = false, this.isScheduling = false, this.schedule = function() {
38756
38756
  t3.isScheduling = true;
38757
38757
  var e2 = t3.tasks.shift();
38758
- e2 && !t3.isDestroy && (e2.status = "running", t3.runningTask = e2, e2.fn.apply(null).then(function() {
38759
- t3.runningTask = void 0, t3.tasks.length > 0 ? setTimeout(t3.schedule) : t3.isScheduling = false;
38760
- }).catch(function() {
38761
- t3.runningTask = void 0, t3.tasks.length > 0 ? setTimeout(t3.schedule) : t3.isScheduling = false;
38762
- }));
38758
+ e2 && !t3.isDestroy ? (e2.status = "running", Promise.resolve().then(e2.fn).catch(function() {
38759
+ }).finally(function() {
38760
+ !t3.isDestroy && t3.tasks.length > 0 ? setTimeout(t3.schedule) : t3.isScheduling = false;
38761
+ })) : t3.isScheduling = false;
38763
38762
  };
38764
38763
  }
38765
- return t2.prototype.getRunningTask = function() {
38766
- var t3;
38767
- return null !== (t3 = this.runningTask) && void 0 !== t3 ? t3 : null;
38768
- }, t2.prototype.addTask = function(t3, e2) {
38769
- var i2 = { type: t3, status: "wait", fn: e2 }, n2 = this.getRunningTask();
38770
- n2 && t3 === n2.type || (this.tasks = this.tasks.filter(function(e3) {
38771
- return e3.type !== t3;
38772
- }), this.tasks.push(i2), this.isScheduling || this.schedule());
38764
+ return t2.prototype.cancelPending = function(t3) {
38765
+ for (var e2, i2 = 0, n2 = this.tasks.splice(0); i2 < n2.length; i2++) {
38766
+ var r2 = n2[i2];
38767
+ try {
38768
+ null === (e2 = r2.onCancelled) || void 0 === e2 || e2.call(r2, new Error("Slide " + r2.type + " task " + t3));
38769
+ } catch (t4) {
38770
+ console.warn("[Slide] frozen task cancellation callback failed", t4);
38771
+ }
38772
+ }
38773
+ }, t2.prototype.addTask = function(t3, e2, i2) {
38774
+ if (this.isDestroy)
38775
+ try {
38776
+ null == i2 || i2(new Error("Slide " + t3 + " task cancelled after destroy"));
38777
+ } catch (t4) {
38778
+ console.warn("[Slide] frozen task cancellation callback failed", t4);
38779
+ }
38780
+ else {
38781
+ this.cancelPending("superseded");
38782
+ var n2 = { type: t3, status: "wait", fn: e2, onCancelled: i2 };
38783
+ this.tasks.push(n2), this.isScheduling || this.schedule();
38784
+ }
38773
38785
  }, t2.prototype.destroy = function() {
38774
- this.isDestroy = true;
38786
+ this.isDestroy = true, this.cancelPending("cancelled after destroy");
38775
38787
  }, t2;
38776
38788
  }(), gw = function() {
38777
38789
  return (gw = Object.assign || function(t2) {
@@ -39453,7 +39465,7 @@ geometry=${JSON.stringify(o2)}`;
39453
39465
  }
39454
39466
  var Nw = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", syncEventLag: "syncEventLag", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange", slideStepEnd: "slideEnd", slideStepStart: "slideStart", useraddLink: "useraddLink" }, Dw = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, Fw = "";
39455
39467
  try {
39456
- Fw = "1.4.62-beta.0";
39468
+ Fw = "1.4.62-beta.1";
39457
39469
  } catch (t2) {
39458
39470
  Fw = "-dev-";
39459
39471
  }
@@ -40230,7 +40242,7 @@ geometry=${JSON.stringify(o2)}`;
40230
40242
  return i3._doFrozen(t3).catch(function(t4) {
40231
40243
  throw null == e3 || e3(t4), t4;
40232
40244
  });
40233
- });
40245
+ }, e3);
40234
40246
  }, e2.prototype._doRelease = function(t3, e3) {
40235
40247
  var i3, n2;
40236
40248
  return Mw(this, void 0, void 0, function() {
@@ -40276,7 +40288,7 @@ geometry=${JSON.stringify(o2)}`;
40276
40288
  return n2._doRelease(t3, e3).catch(function(t4) {
40277
40289
  throw null == i3 || i3(t4), t4;
40278
40290
  });
40279
- });
40291
+ }, i3);
40280
40292
  }, e2.prototype._doDestroy = function() {
40281
40293
  var t3, i3, n2, r3, o2 = this;
40282
40294
  if ("disposed" !== this.lifecycle) {
@@ -44461,7 +44473,7 @@ class SlidePreviewer {
44461
44473
  }
44462
44474
  }
44463
44475
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
44464
- const version = "0.2.106-beta.4";
44476
+ const version = "0.2.106-beta.5";
44465
44477
  const DEFAULT_SLIDE_SETUP_READY_TIMEOUT = 5e3;
44466
44478
  const SlideApp = {
44467
44479
  kind: "Slide",