@basthon/kernel-base 0.41.13 → 0.50.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.
- package/lib/kernel.d.ts +11 -3
- package/lib/kernel.js +21 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/lib/kernel.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class KernelBase {
|
|
|
6
6
|
private _rootPath;
|
|
7
7
|
private _ready;
|
|
8
8
|
private readonly _loaded;
|
|
9
|
-
|
|
9
|
+
_execution_count: number;
|
|
10
10
|
constructor(rootPath: string);
|
|
11
11
|
/**
|
|
12
12
|
* Kernel version number (string).
|
|
@@ -30,6 +30,10 @@ export declare class KernelBase {
|
|
|
30
30
|
* Launch the kernel.
|
|
31
31
|
*/
|
|
32
32
|
launch(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Execution count getter.
|
|
35
|
+
*/
|
|
36
|
+
get execution_count(): number;
|
|
33
37
|
/**
|
|
34
38
|
* Async code evaluation that resolves with the result.
|
|
35
39
|
*/
|
|
@@ -58,8 +62,8 @@ export declare class KernelBase {
|
|
|
58
62
|
*/
|
|
59
63
|
loaded(): Promise<void>;
|
|
60
64
|
/**
|
|
61
|
-
* Root for kernel files. This is always the
|
|
62
|
-
* directory inside the kernel directory.
|
|
65
|
+
* Root for kernel files. This is always the language directory
|
|
66
|
+
* inside the version number directory inside the kernel directory.
|
|
63
67
|
*/
|
|
64
68
|
basthonRoot(absolute?: boolean): string;
|
|
65
69
|
/**
|
|
@@ -83,6 +87,10 @@ export declare class KernelBase {
|
|
|
83
87
|
* manage the event lookup to retreive relevent data.
|
|
84
88
|
*/
|
|
85
89
|
addEventListener(eventName: string, callback: (_: any) => void): void;
|
|
90
|
+
/**
|
|
91
|
+
* Send eval.input event then wait for the user response and return it.
|
|
92
|
+
*/
|
|
93
|
+
inputAsync(prompt: string | null | undefined, password?: boolean, data?: any): Promise<unknown>;
|
|
86
94
|
/**
|
|
87
95
|
* Simple clone via JSON copy.
|
|
88
96
|
*/
|
package/lib/kernel.js
CHANGED
|
@@ -26,7 +26,7 @@ export class KernelBase {
|
|
|
26
26
|
constructor(rootPath) {
|
|
27
27
|
this._ready = false;
|
|
28
28
|
this._loaded = new PromiseDelegate();
|
|
29
|
-
this.
|
|
29
|
+
this._execution_count = 0;
|
|
30
30
|
// root path where kernel is installed
|
|
31
31
|
this._rootPath = rootPath;
|
|
32
32
|
}
|
|
@@ -59,6 +59,10 @@ export class KernelBase {
|
|
|
59
59
|
*/
|
|
60
60
|
async launch() { throw new NotImplementedError("launch"); }
|
|
61
61
|
;
|
|
62
|
+
/**
|
|
63
|
+
* Execution count getter.
|
|
64
|
+
*/
|
|
65
|
+
get execution_count() { return this._execution_count; }
|
|
62
66
|
/**
|
|
63
67
|
* Async code evaluation that resolves with the result.
|
|
64
68
|
*/
|
|
@@ -119,11 +123,11 @@ export class KernelBase {
|
|
|
119
123
|
*/
|
|
120
124
|
async loaded() { await this._loaded.promise; }
|
|
121
125
|
/**
|
|
122
|
-
* Root for kernel files. This is always the
|
|
123
|
-
* directory inside the kernel directory.
|
|
126
|
+
* Root for kernel files. This is always the language directory
|
|
127
|
+
* inside the version number directory inside the kernel directory.
|
|
124
128
|
*/
|
|
125
129
|
basthonRoot(absolute = false) {
|
|
126
|
-
let url = this._rootPath + "/" + this.version();
|
|
130
|
+
let url = this._rootPath + "/" + this.version() + "/" + this.language();
|
|
127
131
|
if (absolute && !url.startsWith("http")) {
|
|
128
132
|
const base = window.location.origin + window.location.pathname;
|
|
129
133
|
url = base.substring(0, base.lastIndexOf('/')) + "/" + url;
|
|
@@ -180,6 +184,19 @@ export class KernelBase {
|
|
|
180
184
|
document.addEventListener(`basthon.${eventName}`, function (event) { callback(event.detail); });
|
|
181
185
|
}
|
|
182
186
|
;
|
|
187
|
+
/**
|
|
188
|
+
* Send eval.input event then wait for the user response and return it.
|
|
189
|
+
*/
|
|
190
|
+
async inputAsync(prompt, password = false, data = undefined) {
|
|
191
|
+
data = this.clone(data);
|
|
192
|
+
data.content = { prompt, password };
|
|
193
|
+
const promise = new Promise(function (resolve, reject) {
|
|
194
|
+
data.resolve = resolve;
|
|
195
|
+
data.reject = reject;
|
|
196
|
+
});
|
|
197
|
+
this.dispatchEvent("eval.input", data);
|
|
198
|
+
return await promise;
|
|
199
|
+
}
|
|
183
200
|
/**
|
|
184
201
|
* Simple clone via JSON copy.
|
|
185
202
|
*/
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.50.0";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.50.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basthon/kernel-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"description": "Basthon - Base Kernel",
|
|
5
5
|
"homepage": "https://basthon.fr",
|
|
6
6
|
"bugs": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "c56536ff3e2be57df447ad94b1c54cd4aeb75e0c"
|
|
40
40
|
}
|