Create your first project
Minimal code for a WebAssembly project
You MUST always include a waiting channel at the end of the main function. If you're not including this channel, the wasm just load, exec and stopped. If you web app export some functions, handle events , all this functional code is unloaded and can't be used.
Your first Hello World
Init your project with the namespace of your choice
Add the hogosuru framework:
Create your main.go with content:
Launch main.go
It open a chrome instance with content
Let's take a closer look at the code
Your main must always call first the initialisation frameworks
Get the current document. If an error occurs AssertErr can handle this error and log in console. It's recommend to use AssertErr to handle error, AssertErr can be hook in a future version to a bug tracker like Sentry.
Get the current body in the document
Create dynamically the htmlelement h1
Set the text between the <h1></h1>
Append the h1 to the end of the node contains in body
Infinite waiting with a channel
Last updated