@basthon/console-react 0.4.9 → 0.5.1

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/gui/gui.d.ts CHANGED
@@ -72,7 +72,7 @@ export default class GUI extends GUIBase {
72
72
  /**
73
73
  * RAZ function.
74
74
  */
75
- restart(): void;
75
+ restart(): Promise<void>;
76
76
  /**
77
77
  * Open *.py file by asking user what to do:
78
78
  * load in editor or put on (emulated) local filesystem.
package/lib/gui/gui.js CHANGED
@@ -149,14 +149,14 @@ export default class GUI extends GUIBase {
149
149
  async runScript() {
150
150
  await this.loaded();
151
151
  const src = this.content();
152
- this._term?.launch(src, false);
152
+ await this._term?.launch(src, false);
153
153
  this._term?.focus();
154
154
  }
155
155
  /**
156
156
  * RAZ function.
157
157
  */
158
- restart() {
159
- this.kernelRestart();
158
+ async restart() {
159
+ await this.kernelRestart();
160
160
  this._term?.clear();
161
161
  this._graphics?.clean();
162
162
  }
@@ -50,7 +50,7 @@ export default class Terminal {
50
50
  /**
51
51
  * Launch code in terminal.
52
52
  */
53
- launch(code: string, interactive?: boolean): void;
53
+ launch(code: string, interactive?: boolean): Promise<void>;
54
54
  /**
55
55
  * Give focus to terminal.
56
56
  */
@@ -103,7 +103,7 @@ export default class Terminal {
103
103
  else {
104
104
  this._term.set_prompt(this._kernel.ps1());
105
105
  this.resetBuffer();
106
- this.launch(source, true);
106
+ await this.launch(source, true);
107
107
  }
108
108
  }
109
109
  /**
@@ -176,19 +176,17 @@ export default class Terminal {
176
176
  /**
177
177
  * Launch code in terminal.
178
178
  */
179
- launch(code, interactive = true) {
179
+ async launch(code, interactive = true) {
180
180
  this._stopWaitInput();
181
+ await this._kernel.ready();
181
182
  if (!interactive)
182
183
  this.showScript(code);
183
184
  this.pause();
184
185
  this._term.set_prompt("");
185
- (async () => {
186
- await this._kernel.ready();
187
- this._kernel.dispatchEvent("eval.request", {
188
- code: code,
189
- interactive: interactive,
190
- });
191
- })();
186
+ this._kernel.dispatchEvent("eval.request", {
187
+ code: code,
188
+ interactive: interactive,
189
+ });
192
190
  }
193
191
  /**
194
192
  * Give focus to terminal.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basthon/console-react",
3
- "version": "0.4.9",
3
+ "version": "0.5.1",
4
4
  "description": "Basthon - Console React Component",
5
5
  "homepage": "https://basthon.fr",
6
6
  "bugs": {
@@ -55,7 +55,7 @@
55
55
  "clean": "rimraf lib/"
56
56
  },
57
57
  "dependencies": {
58
- "@basthon/gui-react": "0.77.5",
58
+ "@basthon/gui-react": "0.78.0",
59
59
  "@fontsource/open-sans": "^5.2.7",
60
60
  "@fortawesome/fontawesome-svg-core": "7.3.0",
61
61
  "@fortawesome/free-regular-svg-icons": "7.3.0",