@opendaw/lib-dom 0.0.35 → 0.0.37

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/frames.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare namespace AnimationFrame {
3
3
  const add: (exec: Exec) => Terminable;
4
4
  const once: (exec: Exec) => void;
5
5
  const start: (owner: WindowProxy) => void;
6
+ const stop: () => void;
6
7
  const terminate: () => void;
7
8
  }
8
9
  export declare const deferNextFrame: (exec: Exec) => DeferExec;
@@ -1 +1 @@
1
- {"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../src/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAiB,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAEhE,yBAAiB,cAAc,CAAC;IAQrB,MAAM,GAAG,GAAI,MAAM,IAAI,KAAG,UAGhC,CAAA;IAEM,MAAM,IAAI,GAAI,MAAM,IAAI,KAAG,IAAgC,CAAA;IAE3D,MAAM,KAAK,GAAI,OAAO,WAAW,KAAG,IAiB1C,CAAA;IAEM,MAAM,SAAS,QAAO,IAM5B,CAAA;CACJ;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,KAAG,SAAgC,CAAA;AAE5E,qBAAa,SAAU,YAAW,UAAU;;gBAM5B,IAAI,EAAE,IAAI;IAEtB,QAAQ,CAAC,OAAO,QAAO,IAAI,CAI1B;IAED,QAAQ,CAAC,SAAS,QAAO,IAAI,CAI5B;IAED,MAAM,IAAI,IAAI;IACd,SAAS,IAAI,IAAI;CAOpB"}
1
+ {"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../src/frames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAiB,UAAU,EAAC,MAAM,kBAAkB,CAAA;AAEhE,yBAAiB,cAAc,CAAC;IAQrB,MAAM,GAAG,GAAI,MAAM,IAAI,KAAG,UAGhC,CAAA;IAEM,MAAM,IAAI,GAAI,MAAM,IAAI,KAAG,IAAgC,CAAA;IAE3D,MAAM,KAAK,GAAI,OAAO,WAAW,KAAG,IAK1C,CAAA;IAEM,MAAM,IAAI,QAAO,IAIvB,CAAA;IAEM,MAAM,SAAS,QAAO,IAK5B,CAAA;CAYJ;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,KAAG,SAAgC,CAAA;AAE5E,qBAAa,SAAU,YAAW,UAAU;;gBAM5B,IAAI,EAAE,IAAI;IAEtB,QAAQ,CAAC,OAAO,QAAO,IAAI,CAI1B;IAED,QAAQ,CAAC,SAAS,QAAO,IAAI,CAI5B;IAED,MAAM,IAAI,IAAI;IACd,SAAS,IAAI,IAAI;CAOpB"}
package/dist/frames.js CHANGED
@@ -11,29 +11,33 @@ export var AnimationFrame;
11
11
  };
12
12
  AnimationFrame.once = (exec) => { nonrecurring.add(exec); };
13
13
  AnimationFrame.start = (owner) => {
14
- const exe = () => {
15
- if (driver !== owner) {
16
- return;
17
- }
18
- if (recurring.size > 0 || nonrecurring.size > 0) {
19
- recurring.forEach((exec) => queue.push(exec));
20
- nonrecurring.forEach((exec) => queue.push(exec));
21
- nonrecurring.clear();
22
- queue.forEach((exec) => exec());
23
- queue.length = 0;
24
- }
25
- id = owner.requestAnimationFrame(exe);
26
- };
27
- id = owner.requestAnimationFrame(exe);
14
+ if (driver === owner) {
15
+ return;
16
+ }
17
+ driver?.cancelAnimationFrame(id);
28
18
  driver = owner;
29
- exe();
19
+ id = owner.requestAnimationFrame(exe);
20
+ };
21
+ AnimationFrame.stop = () => {
22
+ driver?.cancelAnimationFrame(id);
23
+ driver = null;
24
+ id = -1;
30
25
  };
31
26
  AnimationFrame.terminate = () => {
32
- console.debug("AnimationFrame terminate");
33
- nonrecurring.clear();
34
- recurring.clear();
27
+ AnimationFrame.stop();
35
28
  queue.length = 0;
36
- cancelAnimationFrame(id);
29
+ recurring.clear();
30
+ nonrecurring.clear();
31
+ };
32
+ const exe = () => {
33
+ if (recurring.size > 0 || nonrecurring.size > 0) {
34
+ recurring.forEach((exec) => queue.push(exec));
35
+ nonrecurring.forEach((exec) => queue.push(exec));
36
+ nonrecurring.clear();
37
+ queue.forEach((exec) => exec());
38
+ queue.length = 0;
39
+ }
40
+ id = driver?.requestAnimationFrame(exe) ?? -1;
37
41
  };
38
42
  })(AnimationFrame || (AnimationFrame = {}));
39
43
  export const deferNextFrame = (exec) => new DeferExec(exec);
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
- "name": "@opendaw/lib-dom",
3
- "version": "0.0.35",
4
- "main": "./dist/index.js",
5
- "types": "./dist/index.d.ts",
6
- "license": "LGPL-3.0-or-later",
7
- "publishConfig": {
8
- "access": "public"
9
- },
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/index.js"
14
- }
15
- },
16
- "files": [
17
- "dist/**/*"
18
- ],
19
- "scripts": {
20
- "build": "tsc",
21
- "lint": "eslint \"**/*.ts\"",
22
- "test": "vitest run"
23
- },
24
- "dependencies": {
25
- "@opendaw/lib-runtime": "^0.0.35",
26
- "@opendaw/lib-std": "^0.0.35",
27
- "@types/wicg-file-system-access": "^2023.10.6"
28
- },
29
- "devDependencies": {
30
- "@opendaw/eslint-config": "^0.0.19",
31
- "@opendaw/typescript-config": "^0.0.20"
32
- },
33
- "gitHead": "7911c4037c03c3aa6d59cf6790dd86285d58dcf9"
2
+ "name": "@opendaw/lib-dom",
3
+ "version": "0.0.37",
4
+ "main": "./dist/index.js",
5
+ "types": "./dist/index.d.ts",
6
+ "license": "LGPL-3.0-or-later",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist/**/*"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "lint": "eslint \"**/*.ts\"",
22
+ "test": "vitest run"
23
+ },
24
+ "dependencies": {
25
+ "@opendaw/lib-runtime": "^0.0.37",
26
+ "@opendaw/lib-std": "^0.0.37",
27
+ "@types/wicg-file-system-access": "^2023.10.6"
28
+ },
29
+ "devDependencies": {
30
+ "@opendaw/eslint-config": "^0.0.20",
31
+ "@opendaw/typescript-config": "^0.0.20"
32
+ },
33
+ "gitHead": "cbe2d3409a066196db3434a48f61320f29c80d99"
34
34
  }