what

package
v0.804.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package what defines the commands and events used by the JaWS wire protocol.

What values include commands that do not require an Element, Element-associated commands, browser-originated events, and the test-only Hook. What.IsCommand identifies the first group, Parse maps exact wire names, and Invalid is the zero value. See github.com/linkdata/jaws/lib/wire.WsMsg for record framing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type What

type What uint8

What identifies a JaWS wire protocol command or event.

const (
	// Invalid is the zero [What], returned by [Parse] for unrecognized input.
	//
	// It is neither a command nor an event, so [What.IsValid] reports false for it.
	Invalid What = iota

	// Update schedules dirty element processing.
	Update
	// Reload tells the browser to reload the current URL.
	Reload
	// Redirect tells the browser to load another URL.
	Redirect
	// Alert displays an alert message when the client UI supports it.
	Alert
	// Order reorders a set of elements.
	Order
	// Call calls a JavaScript function.
	Call

	// Set updates a JavaScript variable bound to the target element.
	//
	// Data uses the form path=json.
	Set
	// Inner sets the element's inner HTML.
	Inner
	// Delete deletes the element.
	Delete
	// Replace replaces the element with new HTML.
	Replace
	// Remove removes a child element; Data identifies child and Jid identifies parent.
	Remove
	// Insert inserts a child element.
	Insert
	// Append appends a child element.
	Append
	// SAttr sets an element attribute.
	SAttr
	// RAttr removes an element attribute.
	RAttr
	// SClass sets an element class.
	SClass
	// RClass removes an element class.
	RClass
	// Value sets an element value.
	Value

	// Input reports that an element value or input changed.
	Input
	// Click reports that an element was clicked.
	Click
	// ContextMenu reports that a context menu was requested on an element.
	ContextMenu

	// Hook synchronously invokes the matching event handler.
	//
	// Hook is a testing facility rather than part of the browser wire protocol:
	// the JaWS client never sends it, and inbound client messages are never
	// dispatched as Hook. Broadcasting a Hook message lets a test drive an
	// element's event handler synchronously, without round-tripping through the
	// client. The handler must not send messages of its own; any error it
	// returns is delivered to the client as an [Alert].
	Hook
)

func Parse

func Parse(s string) What

Parse returns the What named by s.

Matching is exact and case-sensitive: s must equal a command or event name as produced by What.String, matching what the JaWS client sends on the wire. An empty string is treated as Update. Unknown strings, as well as the names of the internal boundary markers (which are not valid commands or events), return the Invalid zero value.

func (What) IsCommand

func (w What) IsCommand() bool

IsCommand reports whether w is a non-element command.

Commands are the protocol directives that are not tied to a specific element. See also What.IsValid.

func (What) IsValid

func (w What) IsValid() bool

IsValid reports whether w is a known command or event.

See also What.IsCommand and What.String.

func (What) String

func (i What) String() string

Jump to

Keyboard shortcuts

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