Documentation ¶
Overview ¶
Package wasm provides the application entrance for WASM applications and the API for making UI changes. In this context, WASM applications are built off the webgear frameworks and update via this package's UI object.
This package is used in two different places
Inside your Wasm app where you will use the Wasm type to create your client. Inside your web server that is serving the Wasm app where you will use the Handler() func to generate a handler that loads your app.
WASM apps are binaries that are pre-compiled but loaded via JS served from a web browser. Normally it requires an HTML page and JS bootstrapping. We provide the http.Handler that can mount this app and all the bootstrapping JS code.
This package along with the webgear/html and webgear/component remove the need to use HTML or JS within your application.
The app handles all the client display and should fetch content from the server in which to display. This should be done via REST or other HTTP based calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttachHandler ¶
func AttachHandler(event html.EventType, release bool, fn html.WasmFunc, args interface{}, element html.Element) html.Element
AttachHandler attaches a Func to an html.Element for a specific event like a mouse click (PLEASE READ THE REST BEFORE USE). If release is set, the function will release its memory after being called. This should be used when something like a button will not be used again in this evocation. Attach spins out a new goroutine for you to prevent blocking calls from pausing the event loop. Note that this may have negative consequences on performance, but that pause is such a hastle to track down for every new dev that I don't care about that. This func() attaches based on the element's .GlobalAttrs.ID. If that is not set, this is going to panic. As this is an event handler, it replaces any existing handlers. Use even listeners to assign multiple actions.
func AttachListener ¶
func AttachListener(event html.ListenerType, release bool, fn html.WasmFunc, args interface{}, element html.Element) html.Element
AttachListener attaches a Func to an html.Element for a specific event like a mouse click (PLEASE READ THE REST BEFORE USE). If release is set, the function will release its memory after being called. This should be used when something like a button will not be used again in this evocation. Attach spins out a new goroutine for you to prevent blocking calls from pausing the event loop. Note that this may have negative consequences on performance, but that pause is such a hastle to track down for every new dev that I don't care about that. This func() attaches based on the element's .GlobalAttrs.ID. If that is not set, this is going to panic.
func GetDocUpdater ¶
func GetDocUpdater() *html.DocUpdater
GetDocUpdater gets a *DocUpdater for updating the DOM. There is only one of these available for use at any time. Use DocUpdater.Render() to release it. This will block if another call has not released it.
Types ¶
type Wasm ¶
type Wasm struct {
// contains filtered or unexported fields
}
Wasm represents a self contained WASM application.
func (*Wasm) Ready ¶
func (w *Wasm) Ready()
Ready will block until Run() has rendered the initial document. Mostly used in tests.
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
snippets/grpc/proto
Package proto is a reverse proxy.
|
Package proto is a reverse proxy. |