wasm-idle 0.0.19 → 0.0.21

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.
@@ -76,6 +76,11 @@ export const terminal = {
76
76
  term.dispose();
77
77
  if (sandbox)
78
78
  await sandbox.clear();
79
+ },
80
+ async write(input2) {
81
+ await wait();
82
+ term.write(input2 + "\r\n");
83
+ sandbox.write(input2.replaceAll("\r", "\n") + "\n");
79
84
  }
80
85
  };
81
86
  $:
@@ -104,6 +109,7 @@ onMount(() => {
104
109
  return;
105
110
  const ev = e.domEvent;
106
111
  const printable = !ev.altKey && !ev.ctrlKey && !ev.metaKey;
112
+ dispatch("key", ev);
107
113
  if (ev.key === "Enter") {
108
114
  term.write("\r\n");
109
115
  sandbox.write(input + "\n");
@@ -10,10 +10,12 @@ declare const __propDef: {
10
10
  prepare(language: any, code: any, log: boolean | undefined, prog: any): Promise<any>;
11
11
  run(language: any, code: any, log: boolean | undefined, prog: any): Promise<any>;
12
12
  destroy(): Promise<void>;
13
+ write(input: string): Promise<void>;
13
14
  } | undefined;
14
15
  };
15
16
  events: {
16
17
  finish: CustomEvent<any>;
18
+ key: CustomEvent<any>;
17
19
  load: CustomEvent<any>;
18
20
  } & {
19
21
  [evt: string]: CustomEvent<any>;
@@ -29,6 +31,7 @@ export default class Terminal extends SvelteComponentTyped<TerminalProps, Termin
29
31
  prepare(language: any, code: any, log: boolean | undefined, prog: any): Promise<any>;
30
32
  run(language: any, code: any, log: boolean | undefined, prog: any): Promise<any>;
31
33
  destroy(): Promise<void>;
34
+ write(input: string): Promise<void>;
32
35
  };
33
36
  }
34
37
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wasm-idle",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "A simple web app to run C++/Python code in the browser",
5
5
  "license": "MIT",
6
6
  "type": "module",