@netless/slide 0.5.13 → 0.5.14-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.
@@ -3,6 +3,7 @@ export declare class SyncTaskManager {
3
3
  private fn;
4
4
  private tasks;
5
5
  private isDestroy;
6
+ private isScheduling;
6
7
  constructor(fn: (arg: SyncEvent) => Promise<void>);
7
8
  destroy(): void;
8
9
  private schedule;
@@ -3,26 +3,31 @@ var SyncTaskManager = /** @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 () {
7
- var task = _this.tasks[0];
8
+ _this.isScheduling = true;
9
+ var task = _this.tasks.shift();
8
10
  if (task && !_this.isDestroy) {
9
11
  _this.fn(task).then(function () {
10
- _this.tasks.splice(0, 1);
11
- window.requestAnimationFrame(_this.schedule);
12
+ if (_this.tasks.length > 0) {
13
+ window.requestAnimationFrame(_this.schedule);
14
+ }
15
+ else {
16
+ _this.isScheduling = false;
17
+ }
12
18
  });
13
19
  }
14
- else {
15
- window.requestAnimationFrame(_this.schedule);
16
- }
17
20
  };
18
21
  this.fn = fn;
19
- this.schedule();
20
22
  }
21
23
  SyncTaskManager.prototype.destroy = function () {
22
24
  this.isDestroy = true;
23
25
  };
24
26
  SyncTaskManager.prototype.addTask = function (evt) {
25
27
  this.tasks.push(evt);
28
+ if (!this.isScheduling) {
29
+ this.schedule();
30
+ }
26
31
  };
27
32
  return SyncTaskManager;
28
33
  }());
@@ -0,0 +1,2 @@
1
+ import { Ticker } from "pixi.js";
2
+ export declare const ticker: Ticker;
package/lib/Ticker.js ADDED
@@ -0,0 +1,2 @@
1
+ import { Ticker } from "pixi.js";
2
+ export var ticker = new Ticker();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/slide",
3
- "version": "0.5.13",
3
+ "version": "0.5.14-alpha.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "huaguzheng <huaguzheng2007@126.com>",
6
6
  "homepage": "https://github.com/huaguzheng/netless-ppt-plugin/tree/main/packages/slide#readme",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "79609109ffa684e467291f9862dcd98f5112ad6b"
46
+ "gitHead": "c9d45f5880ad6b531dbd9c8b84e24f30ef59794b"
47
47
  }