@thi.ng/api 8.11.0 → 8.11.2
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/CHANGELOG.md +1 -1
- package/mixins/inotify.js +3 -6
- package/mixins/iwatch.js +2 -4
- package/package.json +7 -8
- package/typedarray.js +3 -6
package/CHANGELOG.md
CHANGED
package/mixins/inotify.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { EVENT_ALL } from "../api.js";
|
|
2
2
|
import { mixin } from "../mixin.js";
|
|
3
3
|
const inotify_dispatch = (listeners, e) => {
|
|
4
|
-
if (!listeners)
|
|
5
|
-
return false;
|
|
4
|
+
if (!listeners) return false;
|
|
6
5
|
for (let i = 0, n = listeners.length, l; i < n; i++) {
|
|
7
6
|
l = listeners[i];
|
|
8
7
|
l[0].call(l[1], e);
|
|
@@ -24,8 +23,7 @@ const INotifyMixin = mixin({
|
|
|
24
23
|
},
|
|
25
24
|
removeListener(id, fn, scope) {
|
|
26
25
|
let listeners;
|
|
27
|
-
if (!(listeners = this._listeners))
|
|
28
|
-
return false;
|
|
26
|
+
if (!(listeners = this._listeners)) return false;
|
|
29
27
|
const l = listeners[id];
|
|
30
28
|
if (l) {
|
|
31
29
|
const idx = this.__listener(l, fn, scope);
|
|
@@ -39,8 +37,7 @@ const INotifyMixin = mixin({
|
|
|
39
37
|
},
|
|
40
38
|
notify(e) {
|
|
41
39
|
let listeners;
|
|
42
|
-
if (!(listeners = this._listeners))
|
|
43
|
-
return false;
|
|
40
|
+
if (!(listeners = this._listeners)) return false;
|
|
44
41
|
e.target === void 0 && (e.target = this);
|
|
45
42
|
const res = inotify_dispatch(listeners[e.id], e);
|
|
46
43
|
return inotify_dispatch(listeners[EVENT_ALL], e) || res;
|
package/mixins/iwatch.js
CHANGED
|
@@ -9,8 +9,7 @@ const IWatchMixin = mixin({
|
|
|
9
9
|
return true;
|
|
10
10
|
},
|
|
11
11
|
removeWatch(id) {
|
|
12
|
-
if (!this._watches)
|
|
13
|
-
return;
|
|
12
|
+
if (!this._watches) return;
|
|
14
13
|
if (this._watches[id]) {
|
|
15
14
|
delete this._watches[id];
|
|
16
15
|
return true;
|
|
@@ -18,8 +17,7 @@ const IWatchMixin = mixin({
|
|
|
18
17
|
return false;
|
|
19
18
|
},
|
|
20
19
|
notifyWatches(oldState, newState) {
|
|
21
|
-
if (!this._watches)
|
|
22
|
-
return;
|
|
20
|
+
if (!this._watches) return;
|
|
23
21
|
const w = this._watches;
|
|
24
22
|
for (let id in w) {
|
|
25
23
|
w[id](id, oldState, newState);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/api",
|
|
3
|
-
"version": "8.11.
|
|
3
|
+
"version": "8.11.2",
|
|
4
4
|
"description": "Common, generic types, interfaces & mixins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"build": "yarn build:esbuild && yarn build:decl",
|
|
31
31
|
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
32
32
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
33
|
-
"clean": "
|
|
33
|
+
"clean": "bun ../../tools/src/clean-package.ts decorators mixins",
|
|
34
34
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
35
35
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
36
36
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
@@ -39,11 +39,10 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@microsoft/api-extractor": "^7.43.
|
|
43
|
-
"esbuild": "^0.
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"typescript": "^5.4.3"
|
|
42
|
+
"@microsoft/api-extractor": "^7.43.2",
|
|
43
|
+
"esbuild": "^0.21.1",
|
|
44
|
+
"typedoc": "^0.25.13",
|
|
45
|
+
"typescript": "^5.4.5"
|
|
47
46
|
},
|
|
48
47
|
"keywords": [
|
|
49
48
|
"assert",
|
|
@@ -229,5 +228,5 @@
|
|
|
229
228
|
"default": "./watch.js"
|
|
230
229
|
}
|
|
231
230
|
},
|
|
232
|
-
"gitHead": "
|
|
231
|
+
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
|
|
233
232
|
}
|
package/typedarray.js
CHANGED
|
@@ -94,8 +94,7 @@ function typedArray(type, ...xs) {
|
|
|
94
94
|
}
|
|
95
95
|
function typedArrayOfVec(type, data, stride) {
|
|
96
96
|
const $data = Array.isArray(data) ? data : [...data];
|
|
97
|
-
if (stride === void 0)
|
|
98
|
-
stride = $data[0].length;
|
|
97
|
+
if (stride === void 0) stride = $data[0].length;
|
|
99
98
|
const num = $data.length;
|
|
100
99
|
const res = typedArray(type, num * stride);
|
|
101
100
|
for (let i = 0, j = 0; i < num; i++, j += stride) {
|
|
@@ -104,11 +103,9 @@ function typedArrayOfVec(type, data, stride) {
|
|
|
104
103
|
return res;
|
|
105
104
|
}
|
|
106
105
|
const typedArrayType = (x) => {
|
|
107
|
-
if (Array.isArray(x))
|
|
108
|
-
return "f64";
|
|
106
|
+
if (Array.isArray(x)) return "f64";
|
|
109
107
|
for (let id in TYPEDARRAY_CTORS) {
|
|
110
|
-
if (x instanceof TYPEDARRAY_CTORS[id])
|
|
111
|
-
return id;
|
|
108
|
+
if (x instanceof TYPEDARRAY_CTORS[id]) return id;
|
|
112
109
|
}
|
|
113
110
|
return "f64";
|
|
114
111
|
};
|