| OLD | NEW |
| (Empty) | |
| 1 # Moterm example application |
| 2 |
| 3 `moterm_example_app` is an example application that embeds |
| 4 [Moterm](../../apps/moterm), uses it to provide a prompt, and allows it to be |
| 5 connected to other applications (which should implement the |
| 6 `mojo.terminal.TerminalClient` interface). |
| 7 |
| 8 ## Running |
| 9 |
| 10 On Linux, run it in the usual way, e.g.: |
| 11 |
| 12 $ mojo/devtools/common/mojo_run --enable-multiprocess "mojo:window_manager m
ojo:moterm_example_app" |
| 13 |
| 14 You'll probably need to click on the window to give it keyboard focus. You may |
| 15 also want to resize the window (especially horizontally) to make it bigger. |
| 16 |
| 17 At the `:)` prompt, you may enter the URL for any application implementing the |
| 18 `mojo.terminal.TerminalClient` interface. E.g.: |
| 19 |
| 20 :) mojo:dart_netcat |
| 21 |
| 22 At this point, the terminal's input/output is transferred to the specified |
| 23 application. In this case, it just outputs a help message and closes the |
| 24 terminal, returning you to the `:)` prompt. You may also try: |
| 25 |
| 26 :) mojo:dart_netcat?localhost&port=80 |
| 27 |
| 28 In this case, `mojo:dart_netcat` will make a TCP connection to the specified |
| 29 host/port. Assuming you have a web server running on your machine, you may try |
| 30 entering: |
| 31 |
| 32 GET / |
| 33 |
| 34 (It's probably a bug in `mojo:dart_netcat` that it doesn't close the terminal |
| 35 "file". You can press Control-D to return to the `:)` prompt. The unhandled Dart |
| 36 exception after you press Control-D is definitely a bug.) |
| 37 |
| 38 Another example you may try is: |
| 39 |
| 40 :) file:///path/to/src/examples/js/repl.js |
| 41 |
| 42 At its `>` prompt, you can enter JavaScript expressions. E.g.: |
| 43 |
| 44 > function add(x, y) { return x + y; } |
| 45 undefined |
| 46 > add("hello ", 123) |
| 47 "hello 123" |
| 48 |
| 49 ## See also |
| 50 |
| 51 * [//apps/moterm](../../apps/moterm) |
| 52 * [//examples/dart/netcat](../dart/netcat) |
| 53 * [//examples/js/repl.js](../dart/js/repl.js) |
| OLD | NEW |