@basthon/gui-base 0.36.1 → 0.36.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/lib/main.d.ts +0 -1
- package/lib/main.js +10 -12
- package/package.json +4 -4
package/lib/main.d.ts
CHANGED
package/lib/main.js
CHANGED
|
@@ -7,16 +7,14 @@ import { KernelLoader } from "@basthon/kernel-loader";
|
|
|
7
7
|
export class GUIBase {
|
|
8
8
|
constructor(language) {
|
|
9
9
|
this._loaded = new PromiseDelegate();
|
|
10
|
-
this._kernel = null;
|
|
11
10
|
/* console errors redirected to notification system */
|
|
12
11
|
this._console_error = console.error;
|
|
13
12
|
this._language = language;
|
|
14
13
|
this._loader = new KernelLoader(language);
|
|
15
14
|
// loading Basthon (errors are fatal)
|
|
16
15
|
this._loader.showLoader("Chargement de Basthon...", false);
|
|
17
|
-
this._loader.kernelAvailable().then(() => {
|
|
18
|
-
|
|
19
|
-
window.Basthon = this._kernel;
|
|
16
|
+
this._loader.kernelAvailable().then((kernel) => {
|
|
17
|
+
window.Basthon = kernel;
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
@@ -26,7 +24,7 @@ export class GUIBase {
|
|
|
26
24
|
/**
|
|
27
25
|
* Kernel getter.
|
|
28
26
|
*/
|
|
29
|
-
get kernel() { return this.
|
|
27
|
+
get kernel() { return this._loader.kernel; }
|
|
30
28
|
/**
|
|
31
29
|
* KernelLoader getter.
|
|
32
30
|
*/
|
|
@@ -108,7 +106,7 @@ export class GUIBase {
|
|
|
108
106
|
/**
|
|
109
107
|
* Restart the kernel.
|
|
110
108
|
*/
|
|
111
|
-
kernelRestart() { var _a; (_a = this.
|
|
109
|
+
kernelRestart() { var _a; (_a = this.kernel) === null || _a === void 0 ? void 0 : _a.restart(); }
|
|
112
110
|
/**
|
|
113
111
|
* Load ressources from URL (common part to files and modules).
|
|
114
112
|
*/
|
|
@@ -118,7 +116,7 @@ export class GUIBase {
|
|
|
118
116
|
for (let fileURL of url.searchParams.getAll(key)) {
|
|
119
117
|
fileURL = decodeURIComponent(fileURL);
|
|
120
118
|
const filename = fileURL.split('/').pop() || "";
|
|
121
|
-
let promise =
|
|
119
|
+
let promise = GUIBase.xhr({
|
|
122
120
|
method: "GET",
|
|
123
121
|
url: fileURL,
|
|
124
122
|
responseType: "arraybuffer"
|
|
@@ -143,7 +141,7 @@ export class GUIBase {
|
|
|
143
141
|
reader.onload = async (event) => {
|
|
144
142
|
var _a, _b;
|
|
145
143
|
(_a = this.kernel) === null || _a === void 0 ? void 0 : _a.putRessource(file.name, reader.result);
|
|
146
|
-
this.info("Fichier utilisable depuis Python", `${file.name} est maintenant utilisable depuis ${(_b = this.
|
|
144
|
+
this.info("Fichier utilisable depuis Python", `${file.name} est maintenant utilisable depuis ${(_b = this.kernel) === null || _b === void 0 ? void 0 : _b.languageName()}`);
|
|
147
145
|
resolve();
|
|
148
146
|
};
|
|
149
147
|
reader.onerror = reject;
|
|
@@ -153,17 +151,17 @@ export class GUIBase {
|
|
|
153
151
|
* Load auxiliary files submited via URL (aux= parameter) (async).
|
|
154
152
|
*/
|
|
155
153
|
async loadURLAux() {
|
|
156
|
-
if (this.
|
|
154
|
+
if (this.kernel == null)
|
|
157
155
|
return;
|
|
158
|
-
await this._loadFromURL('aux', this.
|
|
156
|
+
await this._loadFromURL('aux', this.kernel.putFile.bind(this.kernel));
|
|
159
157
|
}
|
|
160
158
|
/**
|
|
161
159
|
* Load modules submited via URL (module= parameter) (async).
|
|
162
160
|
*/
|
|
163
161
|
async loadURLModules() {
|
|
164
|
-
if (this.
|
|
162
|
+
if (this.kernel == null)
|
|
165
163
|
return;
|
|
166
|
-
await this._loadFromURL('module', this.
|
|
164
|
+
await this._loadFromURL('module', this.kernel.putModule.bind(this.kernel));
|
|
167
165
|
}
|
|
168
166
|
/**
|
|
169
167
|
* Opening file: If it has ext as extension, loading it in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basthon/gui-base",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.2",
|
|
4
4
|
"description": "Basthon - Base GUI",
|
|
5
5
|
"homepage": "https://basthon.fr",
|
|
6
6
|
"bugs": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"clean": "rm -rf lib/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@basthon/kernel-base": "^0.36.
|
|
29
|
-
"@basthon/kernel-loader": "^0.36.
|
|
28
|
+
"@basthon/kernel-base": "^0.36.2",
|
|
29
|
+
"@basthon/kernel-loader": "^0.36.2",
|
|
30
30
|
"promise-delegate": "^1.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "8fe755fb31a810261ca52b797c491dea633c17a9"
|
|
41
41
|
}
|