runtime

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

runtime/native_std.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddClass

func AddClass(elementId, class string)

func Alert

func Alert(s string)

func ConsoleError

func ConsoleError(s string)

func ConsoleLog

func ConsoleLog(s string)

func ConsoleWarn

func ConsoleWarn(s string)

func GetInnerHTML

func GetInnerHTML(elementId string) string

GetInnerHTML returns the innerHTML of an element (best-effort). If nanoGoPostMessage is present we don't try to synchronously fetch from the main thread and return an empty string; otherwise we query document directly.

func GetValue

func GetValue(elementId string) string

func HTTPGetText

func HTTPGetText(url string) (string, error)

func LocalStorageGetItem

func LocalStorageGetItem(key string) string

func LocalStorageSetItem

func LocalStorageSetItem(key, value string)

func OpenWindow

func OpenWindow(url string)

func RegisterHostNatives

func RegisterHostNatives(vm *interp.Interpreter, canvas *CanvasBinding)

RegisterHostNatives wires host-provided functions to the interpreter globals.

func RemoveClass

func RemoveClass(elementId, class string)

func SetInnerHTML

func SetInnerHTML(elementId, html string)

func SetValue

func SetValue(elementId, value string)

Types

type CanvasBinding

type CanvasBinding struct {
	Canvas    js.Value
	Context2D js.Value
	CellSize  int
	GridW     int
	GridH     int
}

func BindCanvasById

func BindCanvasById(elementId string, cellSize int) CanvasBinding

func (*CanvasBinding) Flush

func (c *CanvasBinding) Flush()

func (*CanvasBinding) SetCell

func (c *CanvasBinding) SetCell(x, y int, alive bool)

func (*CanvasBinding) Size

func (c *CanvasBinding) Size(gridW, gridH int)

Jump to

Keyboard shortcuts

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