@netless/slide 1.4.57 → 1.4.58

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/README.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  ## changelog
6
6
 
7
+ ### 1.4.58 (2026-09-07)
8
+ * 修复低版本 WebView 中纯色图形显示为黑块的问题
9
+ * 修复切页或销毁 Stage 后无限循环动画回调仍访问已释放 Pixi 对象导致的异常
10
+ * 完善渲染任务取消、失败后的清理与队列推进
11
+
7
12
  ### 1.4.57 (2026-08-27)
8
13
  * 支持在客户端解码并播放本地 GIF 资源,兼容旧版 Safari
9
14
  * 修复 WebGL 切页转场被错误关闭的问题
@@ -1,4 +1,8 @@
1
1
  import EventEmitter from "eventemitter3";
2
+ export declare class RenderTaskCancelledError extends Error {
3
+ readonly code: string;
4
+ constructor(message?: string);
5
+ }
2
6
  export declare class Task {
3
7
  state: "idle" | "start" | "end";
4
8
  index: number;
@@ -6,16 +10,20 @@ export declare class Task {
6
10
  private fn;
7
11
  private eventHub;
8
12
  id: string;
13
+ private cancelled;
9
14
  constructor(index: number, slideIndex: number, fn: () => Promise<void>, eventHub: EventEmitter, id: string);
10
15
  apply(): Promise<void>;
16
+ cancel(): void;
11
17
  }
12
18
  export declare class RenderingTaskManager {
13
19
  eventHub: EventEmitter;
14
20
  private tasks;
15
21
  private index;
22
+ private destroyed;
16
23
  constructor();
24
+ private cancelTask;
17
25
  private replaceIdleTask;
18
- addTask(fn: () => Promise<void>, slideIndex: number, id: string): void;
26
+ addTask(fn: () => Promise<void>, slideIndex: number, id: string): Task | undefined;
19
27
  hasStartTask(): boolean;
20
28
  destroy(): void;
21
29
  }
@@ -102,6 +102,14 @@ var Task = /** @class */ (function () {
102
102
  if (this.cancelled) {
103
103
  return [2 /*return*/];
104
104
  }
105
+ if (e_1 instanceof RenderTaskCancelledError) {
106
+ this.cancel();
107
+ this.eventHub.emit("task-cancel", {
108
+ task: this,
109
+ error: e_1,
110
+ });
111
+ return [2 /*return*/];
112
+ }
105
113
  this.eventHub.emit("task-error", {
106
114
  task: this,
107
115
  error: e_1,
@@ -139,19 +147,29 @@ var RenderingTaskManager = /** @class */ (function () {
139
147
  _this.eventHub.emit("task-end-" + task.id);
140
148
  });
141
149
  this.eventHub.on("task-error", function (_a) {
150
+ var _b;
142
151
  var task = _a.task, error = _a.error;
143
152
  var selfIndex = _this.tasks.findIndex(function (t) { return t.index === task.index; });
153
+ var wasRunning = task.state === "start";
144
154
  if (selfIndex >= 0) {
145
155
  _this.tasks.splice(selfIndex, 1);
146
156
  _this.replaceIdleTask();
157
+ if (wasRunning && !_this.destroyed) {
158
+ (_b = _this.tasks[selfIndex]) === null || _b === void 0 ? void 0 : _b.apply();
159
+ }
147
160
  }
148
161
  _this.eventHub.emit("task-error-" + task.id, error);
149
162
  });
150
163
  this.eventHub.on("task-cancel", function (_a) {
164
+ var _b;
151
165
  var task = _a.task, error = _a.error;
152
166
  var selfIndex = _this.tasks.findIndex(function (t) { return t.index === task.index; });
167
+ var wasRunning = task.state === "start";
153
168
  if (selfIndex >= 0) {
154
169
  _this.tasks.splice(selfIndex, 1);
170
+ if (wasRunning && !_this.destroyed) {
171
+ (_b = _this.tasks[selfIndex]) === null || _b === void 0 ? void 0 : _b.apply();
172
+ }
155
173
  }
156
174
  _this.eventHub.emit("task-cancel-" + task.id, error);
157
175
  });
package/lib/Slide.d.ts CHANGED
@@ -456,6 +456,9 @@ export declare class Slide extends Slide_base {
456
456
  private resize;
457
457
  private isAnimating;
458
458
  private renderingTaskManager;
459
+ private lifecycle;
460
+ private lifecycleGeneration;
461
+ private renderVisibilityTimers;
459
462
  private isLoading;
460
463
  private isReleasing;
461
464
  private interactive;
@@ -503,6 +506,7 @@ export declare class Slide extends Slide_base {
503
506
  private handleSyncQueueCompactRenderComplete;
504
507
  private handleSyncQueueCatchUpStateChange;
505
508
  private updatePlayerInteractive;
509
+ private observeRenderTask;
506
510
  private recoverHandler;
507
511
  private reportError;
508
512
  initSlideConfig(config: ISlideConfig): ISlideConfig;