Skip to content
Max Ng edited this page Oct 20, 2019 · 19 revisions

Welcome to the TED-GUI wiki!

This page seeks to provide information on the integration of TED Wasm used in TED-GUI App. Hopefully this will enable enough information to build your own html and javascript to interact with TED Wasm.

A good place to start with WebAssembly/Wasm will be WebAssembly Website and Mozilla Site on using WebAssembly on browser. TED-GUI wasm was an extension of TED app both written in GO. Its the same application logic but with slight modification compiled for wasm. GOlang has since version 1.11 supported WASM/JS as beta port. Some of the works are still in development. Wasm interacts with the browser frontend using js, and it is possible to build a html web app with wasm interacting with js. Go WebAssembly provides the documentation and Syscall/js provides the documentation on the js API available for js to interact with GO function within wasm.

TED-GUI wasm uses a much simplier approach. Using the same concept as TED, it exposes the CLI through go/flags and allows js to interact with the wasm by passing the necessary CLI arguments. This Wiki the CLI arguments and shows how js can interact using argv.js. With this information, you can build a html or WebApp using JS with TED-GUI wasm.

Anatomy of TED-GUI WASM

This is taken from a Firefox browser with developer console. TED-GUI wasm is triggered without any arguments and the following error is output to console. The binary expects the following argument to be supplied to it

-e Encryption set to true by default, to decrypt set -e=false or -e=0 -p passphrase to be used for encryption or decryption. Please remember the passphrase. -t text to be encipher/decipher

From the same console, you will also notice an array with [ "ted-wb.wasm", "-p", "", "", "-t", "" ] This is javascript using argv.js to pass the arguments in array to wasm. The name of the wasm must come first as the js api expects it, but the rest of the arguments need not be in the right sequence, however all 3 arguments are needed.

An error free execution would look like this Notice the array [ "ted-wb.wasm", "-p", "123", "-e", "-t", "hello%20world!" ] which correlates to the input and selection on the html form.

You can design your html or webapp and provides the 3 necessary inputs to TED-GUI wasm for computing.

Clone this wiki locally