@netless/slide 0.5.11 → 0.5.16-alpha.0

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.
@@ -6,7 +6,7 @@ export interface FrozenTask {
6
6
  export declare class FrozenTaskManager {
7
7
  private tasks;
8
8
  private isDestroy;
9
- constructor();
9
+ private isScheduling;
10
10
  private schedule;
11
11
  private getRunningTask;
12
12
  addTask(type: "frozen" | "release", fn: () => Promise<void>): void;
@@ -3,21 +3,29 @@ var FrozenTaskManager = /** @class */ (function () {
3
3
  var _this = this;
4
4
  this.tasks = [];
5
5
  this.isDestroy = false;
6
+ this.isScheduling = false;
6
7
  this.schedule = function () {
8
+ _this.isScheduling = true;
7
9
  var task = _this.tasks.shift();
8
10
  if (task && !_this.isDestroy) {
9
11
  task.status = "running";
10
12
  task.fn.apply(null).then(function () {
11
- window.setTimeout(_this.schedule);
13
+ if (_this.tasks.length > 0) {
14
+ window.requestAnimationFrame(_this.schedule);
15
+ }
16
+ else {
17
+ _this.isScheduling = false;
18
+ }
12
19
  }).catch(function () {
13
- window.setTimeout(_this.schedule);
20
+ if (_this.tasks.length > 0) {
21
+ window.requestAnimationFrame(_this.schedule);
22
+ }
23
+ else {
24
+ _this.isScheduling = false;
25
+ }
14
26
  });
15
27
  }
16
- else {
17
- window.setTimeout(_this.schedule);
18
- }
19
28
  };
20
- this.schedule();
21
29
  }
22
30
  FrozenTaskManager.prototype.getRunningTask = function () {
23
31
  if (this.tasks[0] && this.tasks[0].status === "running") {
@@ -38,6 +46,9 @@ var FrozenTaskManager = /** @class */ (function () {
38
46
  else {
39
47
  this.tasks = this.tasks.filter(function (v) { return v.type !== type; });
40
48
  this.tasks.push(task);
49
+ if (!this.isScheduling) {
50
+ this.schedule();
51
+ }
41
52
  }
42
53
  };
43
54
  FrozenTaskManager.prototype.destroy = function () {
package/lib/Slide.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SlideError, ILoaderDelegate } from "@netless/ppt-player";
2
+ import { useSlidePlugin } from "@netless/plugin-system";
2
3
  export { ErrorType } from "@netless/ppt-player";
3
- export { usePlugin } from "@netless/plugin-system";
4
4
  export type { ILoaderDelegate } from "@netless/ppt-player";
5
5
  export interface RtcAudio {
6
6
  /**
@@ -297,6 +297,7 @@ export declare class Slide extends Slide_base {
297
297
  static _tempLog: string;
298
298
  static _tempLogIndex: number;
299
299
  static flushLog(): Promise<void>;
300
+ static usePlugin: typeof useSlidePlugin;
300
301
  private iosResetCache;
301
302
  private iosNewPlayer?;
302
303
  private needClearCacheImage;