wasmShellStart starts the interactive shell as a Promise
()
| 79 | |
| 80 | // wasmShellStart starts the interactive shell as a Promise |
| 81 | func wasmShellStart() js.Func { |
| 82 | return js.FuncOf(func(this js.Value, args []js.Value) any { |
| 83 | |
| 84 | handler := js.FuncOf(func(this js.Value, args []js.Value) any { |
| 85 | resolve := args[0] |
| 86 | //reject := args[1] |
| 87 | |
| 88 | go func() { |
| 89 | resolve.Invoke("Starting interactive shell....") |
| 90 | shell.Start() |
| 91 | }() |
| 92 | |
| 93 | // The handler of a Promise doesn't return any value |
| 94 | return nil |
| 95 | }) |
| 96 | |
| 97 | // Create and return the Promise object |
| 98 | promiseConstructor := js.Global().Get("Promise") |
| 99 | return promiseConstructor.New(handler) |
| 100 | }) |
| 101 | } |
| 102 | |
| 103 | // wasmKeyPress starts the interactive shell as a Promise |
| 104 | func wasmKeyPress() js.Func { |