wasm-idle 0.0.2 → 0.0.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.
|
@@ -5,8 +5,17 @@ import { load } from "../playground";
|
|
|
5
5
|
import "xterm/css/xterm.css";
|
|
6
6
|
const dispatch = createEventDispatcher();
|
|
7
7
|
let ref, clientWidth, clientHeight, term, finish = true, input = "", sandbox, first = true;
|
|
8
|
+
const wait = new Promise((r) => {
|
|
9
|
+
const i = setInterval(() => {
|
|
10
|
+
if (term) {
|
|
11
|
+
clearInterval(i);
|
|
12
|
+
r();
|
|
13
|
+
}
|
|
14
|
+
}, 100);
|
|
15
|
+
});
|
|
8
16
|
export const terminal = {
|
|
9
|
-
clear() {
|
|
17
|
+
async clear() {
|
|
18
|
+
await wait;
|
|
10
19
|
term.clear();
|
|
11
20
|
term.write(`\x1B[?25l`);
|
|
12
21
|
term.write("\x1B[0m");
|
|
@@ -14,6 +23,7 @@ export const terminal = {
|
|
|
14
23
|
first = true;
|
|
15
24
|
},
|
|
16
25
|
async run(language, code, log = true) {
|
|
26
|
+
await wait;
|
|
17
27
|
if (sandbox)
|
|
18
28
|
await sandbox.clear();
|
|
19
29
|
input = "";
|
|
@@ -3,7 +3,7 @@ import 'xterm/css/xterm.css';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
terminal?: {
|
|
6
|
-
clear(): void
|
|
6
|
+
clear(): Promise<void>;
|
|
7
7
|
run(language: any, code: any, log?: boolean): Promise<void>;
|
|
8
8
|
} | undefined;
|
|
9
9
|
dark?: boolean | undefined;
|
|
@@ -22,7 +22,7 @@ export type TerminalEvents = typeof __propDef.events;
|
|
|
22
22
|
export type TerminalSlots = typeof __propDef.slots;
|
|
23
23
|
export default class Terminal extends SvelteComponentTyped<TerminalProps, TerminalEvents, TerminalSlots> {
|
|
24
24
|
get terminal(): {
|
|
25
|
-
clear(): void
|
|
25
|
+
clear(): Promise<void>;
|
|
26
26
|
run(language: any, code: any, log?: boolean): Promise<void>;
|
|
27
27
|
};
|
|
28
28
|
}
|