Help us shape the future of Go! Take the 2026 Go Developer Survey

wasm

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package wasm runs Go WebAssembly code for folio pages. Register a function per route, then call Run from main:

func main() {
	wasm.Page("index", func() func() {
		// set up the page; optionally return a cleanup function
		return nil
	})
	wasm.Run()
}

The function for the current route runs on the first page load and after every in-place navigation; the previous page's cleanup runs first.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Always

func Always(fn PageFunc)

Always registers fn to run on every page, before the route's own function.

func Page

func Page(route string, fn PageFunc)

Page registers fn for a route name, e.g. "index" or "journal/[id]".

func Route

func Route() string

Route returns the current route name, as reported by the folio client.

func Run

func Run()

Run starts running page functions and blocks forever. The folio client script must be on the page.

Types

type PageFunc

type PageFunc func() (cleanup func())

PageFunc sets up a page and may return a cleanup function (or nil) that runs before the next page's PageFunc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL