Documentation
¶
Index ¶
- func AddClass(id, className string)
- func AddEventListener(el JSValue, event string, fn func())
- func AddEventListenerWithEvent(el JSValue, event string, fn func(JSValue))
- func AppendChild(parent, child JSValue)
- func BeginBatch()
- func BroadcastTopicEncoded(keyName, encoded string)
- func BroadcastTopicEncodedField(keyName, fieldName, encoded string)
- func BroadcastTopicOnline(keyName, encoded string)
- func ClickElement(el JSValue)
- func ConsoleLog(args ...any)
- func CookieDelete(key string)
- func CookieGet(key string) string
- func CookieSet(key, value string, opts ...CookieOptions)
- func CopyBytesToGo(dst []byte, src JSValue) int
- func CopyBytesToJS(dst JSValue, src []byte) int
- func CreateTopic[T any](zero T, cfg TopicConfig) func() interface{}
- func CreateWasmBoolFunc(name string, fn func(bool))
- func CreateWasmFunc(name string, fn func())
- func CreateWasmStringFunc(name string, fn func(string))
- func EndBatch()
- func ExecJS(script string)
- func Fetch(url string, config ...FetchConfig) (string, error)
- func FetchBytes(url string, config ...FetchConfig) ([]byte, error)
- func GetFileBytes(id string) []byte
- func GetValue(id string) string
- func GoBack()
- func HexDecode(s string) []byte
- func HexEncode(src []byte) string
- func ListenTopicEvent(keyName string, fn func(string))
- func ListenTopicEventField(keyName, fieldName string, fn func(string))
- func ListenTopicOnline(keyName string, fn func(string))
- func ListenTopicPing(keyName string, fn func())
- func ListenTopicSetReq(keyName string, fn func(string))
- func ListenTopicSetReqField(keyName, fieldName string, fn func(string))
- func LocalStorageGet(key string) string
- func LocalStorageRemove(key string)
- func LocalStorageSet(key, value string)
- func Navigate(url string)
- func PingTopicManager(keyName string)
- func PingUntilOnline(keyName string, isOnline func() bool)
- func PushState(url, title string)
- func Reload()
- func RemoveClass(id, className string)
- func RemoveElement(el JSValue)
- func RequestTopicSet(keyName, encoded string)
- func RequestTopicSetField(keyName, fieldName, encoded string)
- func SessionStorageGet(key string) string
- func SessionStorageRemove(key string)
- func SessionStorageSet(key, value string)
- func SetAttr(id, attr, value string)
- func SetHTML(id, html string)
- func SetStyle(id, property, value string)
- func SetText(id, value string)
- func SetValue(id, value string)
- func ToggleClass(id, className string)
- func TriggerDownload(filename string, data []byte, mimeType string)
- func UpdateTopicOnlineStore(keyName string, encoded []byte)
- func WriteClipboard(text string)
- type Compression
- type CookieOptions
- type Decoder
- func (d *Decoder) Bool() bool
- func (d *Decoder) Bytes() []byte
- func (d *Decoder) F32() float32
- func (d *Decoder) F64() float64
- func (d *Decoder) I32() int32
- func (d *Decoder) I64() int64
- func (d *Decoder) String() string
- func (d *Decoder) U8() uint8
- func (d *Decoder) U16() uint16
- func (d *Decoder) U32() uint32
- func (d *Decoder) U64() uint64
- type Encoder
- func (e *Encoder) Bool(v bool)
- func (e *Encoder) Bytes(v []byte)
- func (e *Encoder) F32(v float32)
- func (e *Encoder) F64(v float64)
- func (e *Encoder) I32(v int32)
- func (e *Encoder) I64(v int64)
- func (e *Encoder) String(v string)
- func (e *Encoder) U8(v uint8)
- func (e *Encoder) U16(v uint16)
- func (e *Encoder) U32(v uint32)
- func (e *Encoder) U64(v uint64)
- type FetchConfig
- type JSValue
- func (v JSValue) Bool() bool
- func (v JSValue) Call(method string, args ...any) JSValue
- func (v JSValue) Float() float64
- func (v JSValue) Get(key string) JSValue
- func (v JSValue) Index(i int) JSValue
- func (v JSValue) Int() int
- func (v JSValue) IsNull() bool
- func (v JSValue) IsUndefined() bool
- func (v JSValue) Length() int
- func (v JSValue) New(args ...any) JSValue
- func (v JSValue) Set(key string, val any)
- func (v JSValue) SetIndex(i int, val any)
- func (v JSValue) String() string
- func (v JSValue) Truthy() bool
- type Observable
- type ObservableField
- type SharedTopicObservable
- type Subscription
- type TopicConfig
- type TopicKey
- func AutoKey[T any](name string) TopicKey[T]
- func BinaryKey[T any](name string, encode func(T, *Encoder), decode func(*Decoder) T) TopicKey[T]
- func BoolKey(name string) TopicKey[bool]
- func ByteKey(name string) TopicKey[byte]
- func CustomKey[T any](name string, encode func(T) string, decode func(string) T) TopicKey[T]
- func Float32Key(name string) TopicKey[float32]
- func Float64Key(name string) TopicKey[float64]
- func Int8Key(name string) TopicKey[int8]
- func Int16Key(name string) TopicKey[int16]
- func Int32Key(name string) TopicKey[int32]
- func Int64Key(name string) TopicKey[int64]
- func IntKey(name string) TopicKey[int]
- func RuneKey(name string) TopicKey[rune]
- func StringKey(name string) TopicKey[string]
- func Uint8Key(name string) TopicKey[uint8]
- func Uint16Key(name string) TopicKey[uint16]
- func Uint32Key(name string) TopicKey[uint32]
- func Uint64Key(name string) TopicKey[uint64]
- func UintKey(name string) TopicKey[uint]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddEventListener ¶
func AppendChild ¶
func AppendChild(parent, child JSValue)
func BroadcastTopicEncoded ¶
func BroadcastTopicEncoded(keyName, encoded string)
func BroadcastTopicEncodedField ¶
func BroadcastTopicEncodedField(keyName, fieldName, encoded string)
func BroadcastTopicOnline ¶
func BroadcastTopicOnline(keyName, encoded string)
func ClickElement ¶
func ClickElement(el JSValue)
func ConsoleLog ¶
func ConsoleLog(args ...any)
func CookieDelete ¶
func CookieDelete(key string)
func CookieSet ¶
func CookieSet(key, value string, opts ...CookieOptions)
func CopyBytesToGo ¶
func CopyBytesToJS ¶
func CreateTopic ¶
func CreateTopic[T any](zero T, cfg TopicConfig) func() interface{}
CreateTopic declares a topic. The CLI AST scanner detects this call and generates the concrete typed accessor. At runtime this returns a no-op.
func CreateWasmBoolFunc ¶
func CreateWasmFunc ¶
func CreateWasmFunc(name string, fn func())
func CreateWasmStringFunc ¶
func FetchBytes ¶
func FetchBytes(url string, config ...FetchConfig) ([]byte, error)
func GetFileBytes ¶
func ListenTopicEvent ¶
func ListenTopicEventField ¶
func ListenTopicOnline ¶
func ListenTopicPing ¶
func ListenTopicPing(keyName string, fn func())
func ListenTopicSetReq ¶
func ListenTopicSetReqField ¶
func LocalStorageGet ¶
func LocalStorageRemove ¶
func LocalStorageRemove(key string)
func LocalStorageSet ¶
func LocalStorageSet(key, value string)
func PingTopicManager ¶
func PingTopicManager(keyName string)
func PingUntilOnline ¶
func RemoveClass ¶
func RemoveClass(id, className string)
func RemoveElement ¶
func RemoveElement(el JSValue)
func RequestTopicSet ¶
func RequestTopicSet(keyName, encoded string)
func RequestTopicSetField ¶
func RequestTopicSetField(keyName, fieldName, encoded string)
func SessionStorageGet ¶
func SessionStorageRemove ¶
func SessionStorageRemove(key string)
func SessionStorageSet ¶
func SessionStorageSet(key, value string)
func ToggleClass ¶
func ToggleClass(id, className string)
func TriggerDownload ¶
func UpdateTopicOnlineStore ¶
func WriteClipboard ¶
func WriteClipboard(text string)
Types ¶
type Compression ¶
type Compression int
Compression is the compression algorithm used for a topic's WASM payload.
const ( GZIP Compression = iota // default BROTLI Compression = iota )
type CookieOptions ¶
type Decoder ¶
Decoder reads a little-endian binary stream. Err accumulates the first decode error — check it once at the end rather than per call.
type Encoder ¶
type Encoder struct{ Buf []byte }
Encoder writes a little-endian binary stream into Buf. Preallocate with NewEncoder to avoid repeated append growth.
func NewEncoder ¶
type FetchConfig ¶
type JSValue ¶
type JSValue struct{}
func CreateElement ¶
func GetElementById ¶
func QuerySelector ¶
func QuerySelectorAll ¶
func (JSValue) IsUndefined ¶
type Observable ¶
type Observable[T any] struct { // contains filtered or unexported fields }
func CreateObservable ¶
func CreateObservable[T any](initial T) *Observable[T]
func (*Observable[T]) Get ¶
func (s *Observable[T]) Get() T
func (*Observable[T]) Set ¶
func (s *Observable[T]) Set(v T)
type ObservableField ¶
type ObservableField[T any] struct { // contains filtered or unexported fields }
ObservableField stub — no-op broadcast and tracking for server-side compilation.
func NewObservableField ¶
func NewObservableField[T any](initial T) *ObservableField[T]
func (*ObservableField[T]) ApplyExternal ¶
func (f *ObservableField[T]) ApplyExternal(v T)
func (*ObservableField[T]) Get ¶
func (f *ObservableField[T]) Get() T
func (*ObservableField[T]) Peek ¶
func (f *ObservableField[T]) Peek() T
func (*ObservableField[T]) Set ¶
func (f *ObservableField[T]) Set(v T)
func (*ObservableField[T]) SetBroadcast ¶
func (f *ObservableField[T]) SetBroadcast(fn func())
type SharedTopicObservable ¶
type SharedTopicObservable[T any] struct { // contains filtered or unexported fields }
func (*SharedTopicObservable[T]) Get ¶
func (s *SharedTopicObservable[T]) Get() T
func (*SharedTopicObservable[T]) Set ¶
func (s *SharedTopicObservable[T]) Set(v T)
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func Observe ¶
func Observe(fn func(), deps ...any) *Subscription
func ObserveWithCleanup ¶
func ObserveWithCleanup(fn func() func(), deps ...any) *Subscription
func (*Subscription) Stop ¶
func (e *Subscription) Stop()
type TopicConfig ¶
type TopicConfig struct {
Name string
Compression Compression // GZIP (default) or BROTLI
SubscriberFnName string // overrides generated accessor func name (default: <StructName>Topic)
ComponentFnName string // overrides generated mount component func name (default: Add<StructName>Topic)
}
TopicConfig holds per-topic configuration.
Click to show internal directories.
Click to hide internal directories.