@netless/slide 0.3.8 → 0.4.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.
@@ -2,7 +2,9 @@ import { SyncEvent } from "./Slide";
2
2
  export declare class SyncTaskManager {
3
3
  private fn;
4
4
  private tasks;
5
+ private isDestroy;
5
6
  constructor(fn: (arg: SyncEvent) => Promise<void>);
7
+ destroy(): void;
6
8
  private schedule;
7
9
  addTask(evt: SyncEvent): void;
8
10
  }
@@ -2,9 +2,10 @@ var SyncTaskManager = /** @class */ (function () {
2
2
  function SyncTaskManager(fn) {
3
3
  var _this = this;
4
4
  this.tasks = [];
5
+ this.isDestroy = false;
5
6
  this.schedule = function () {
6
7
  var task = _this.tasks[0];
7
- if (task) {
8
+ if (task && !_this.isDestroy) {
8
9
  _this.fn(task).then(function () {
9
10
  _this.tasks.splice(0, 1);
10
11
  window.requestAnimationFrame(_this.schedule);
@@ -17,6 +18,9 @@ var SyncTaskManager = /** @class */ (function () {
17
18
  this.fn = fn;
18
19
  this.schedule();
19
20
  }
21
+ SyncTaskManager.prototype.destroy = function () {
22
+ this.isDestroy = true;
23
+ };
20
24
  SyncTaskManager.prototype.addTask = function (evt) {
21
25
  this.tasks.push(evt);
22
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/slide",
3
- "version": "0.3.8",
3
+ "version": "0.4.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",
@@ -39,5 +39,5 @@
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "1d3460da2746600a19a7dd1d829291397fe62776"
42
+ "gitHead": "992da3d7e220316e389e8b85e8b2fd1bfdf76545"
43
43
  }