@basthon/kernel-base 0.64.1 → 0.64.3
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/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/worker/kernel-worker.d.ts +2 -0
- package/lib/worker/kernel-worker.js +14 -0
- package/package.json +2 -2
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.64.
|
|
1
|
+
export declare const VERSION = "0.64.3";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.64.
|
|
1
|
+
export const VERSION = "0.64.3";
|
|
@@ -5,6 +5,8 @@ declare global {
|
|
|
5
5
|
_remoteProxy: Remote<ProxyFetch>;
|
|
6
6
|
basthon: KernelWorkerBase;
|
|
7
7
|
_prompt: (p?: string, _d?: string) => string | null;
|
|
8
|
+
window?: DedicatedWorkerGlobalScope;
|
|
9
|
+
Canvas: typeof OffscreenCanvas | ((w: number, h: number) => HTMLCanvasElement);
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
type ExecuteResult = {
|
|
@@ -13,6 +13,20 @@ class KernelWorkerBase {
|
|
|
13
13
|
mockFetch(this.isLegacy());
|
|
14
14
|
// useful for ffi
|
|
15
15
|
self.basthon = this;
|
|
16
|
+
// the window object is not available in a webworker...
|
|
17
|
+
if (self.window == null)
|
|
18
|
+
self.window = self;
|
|
19
|
+
// common way to create a canvas in worker and legacy mode
|
|
20
|
+
self.Canvas = !this.isLegacy()
|
|
21
|
+
? globalThis.OffscreenCanvas
|
|
22
|
+
: function Canvas(width, height) {
|
|
23
|
+
const canvas = document.createElement("canvas");
|
|
24
|
+
if (width != null)
|
|
25
|
+
canvas.width = width;
|
|
26
|
+
if (height != null)
|
|
27
|
+
canvas.height = height;
|
|
28
|
+
return canvas;
|
|
29
|
+
};
|
|
16
30
|
// global prompt redirected to our input
|
|
17
31
|
if (self._prompt == null)
|
|
18
32
|
self._prompt = globalThis.prompt;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basthon/kernel-base",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.3",
|
|
4
4
|
"description": "Basthon - Base Kernel",
|
|
5
5
|
"homepage": "https://basthon.fr",
|
|
6
6
|
"bugs": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ef45edbf7dcdde8400ffc6ec89cd2d513b8776ee"
|
|
48
48
|
}
|