wasa

package module
v0.0.0-...-57186e4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: MIT Imports: 5 Imported by: 0

README

wasa

A tiny library to create Web-Apps with Golang and WebAssembly.

Quick Start (TodoMVC example)

Navigate to example/todomvc and run devserver go run devserver.go

In your browser go to http://127.0.0.1:8080/ and look ...

(Thanks to https://github.com/vugu/vugu for a couple of useful inspirations)

Documentation

Index

Constants

View Source
const (
	ClickEvent     = "click"
	DblclickEvent  = "dblclick"
	MousedownEvent = "mousedown"
	MouseupEvent   = "mouseup"
	MouseoverEvent = "mouseover"
	MousemoveEvent = "mousemove"
	MouseoutEvent  = "mouseout"
	KeydownEvent   = "keydown"
	KeypressEvent  = "keypress"
	KeyupEvent     = "keyup"
	LoadEvent      = "load"
	UnloadEvent    = "unload"
	AbortEvent     = "abort"
	ResizeEvent    = "resize"
	ScrollEvent    = "scroll"
	ChangeEvent    = "change"
	SubmitEvent    = "submit"
	ResetEvent     = "reset"
	FocusEvent     = "focus"
	BlurEvent      = "blur"
)
View Source
const (
	DivTag    = "div"
	SpanTag   = "span"
	InputTag  = "input"
	ButtonTag = "button"
	StyleTag  = "style"
	H1Tag     = "h1"
	H2Tag     = "h2"
	H3Tag     = "h3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attrs

type Attrs map[string]string

type Canvas

type Canvas struct {
	// contains filtered or unexported fields
}

func NewCanvas

func NewCanvas(class string, id string) *Canvas

func (*Canvas) BeginPath

func (c *Canvas) BeginPath()

func (*Canvas) Clear

func (c *Canvas) Clear()

func (*Canvas) Dim

func (c *Canvas) Dim() (int, int)

func (*Canvas) Ellipse

func (c *Canvas) Ellipse(center draw.Pt, rX, rY int, rot float64, startAngle, endAngle float64, anticlockwise bool)

func (*Canvas) Elt

func (c *Canvas) Elt() *Elt

func (*Canvas) Fill

func (c *Canvas) Fill()

func (*Canvas) FillStyle

func (c *Canvas) FillStyle(fs string)

func (*Canvas) FillText

func (c *Canvas) FillText(s string, p draw.Pt)

func (*Canvas) Font

func (c *Canvas) Font(fs string)

func (*Canvas) InitCtx

func (c *Canvas) InitCtx()

func (*Canvas) LineTo

func (c *Canvas) LineTo(p draw.Pt)

func (*Canvas) MoveTo

func (c *Canvas) MoveTo(p draw.Pt)

func (*Canvas) Rect

func (c *Canvas) Rect(x, y, width, height int)

func (*Canvas) Stroke

func (c *Canvas) Stroke()

func (*Canvas) StrokeStyle

func (c *Canvas) StrokeStyle(fs string)

func (*Canvas) StrokeText

func (c *Canvas) StrokeText(s string, p draw.Pt)

type Document

type Document struct {
	js.Value
	// contains filtered or unexported fields
}

func NewDocument

func NewDocument(title string) (*Document, error)

func (*Document) Callback

func (d *Document) Callback(eventType string, elt *Elt, cb ElementCallback)

Callbacks

func (*Document) CreateElementNode

func (d *Document) CreateElementNode(tag string) (js.Value, error)

func (*Document) GetGlobal

func (d *Document) GetGlobal(names ...string) js.Value

func (*Document) Location

func (d *Document) Location() *url.URL

func (*Document) Run

func (d *Document) Run(root *Elt)

func (*Document) SignalRender

func (d *Document) SignalRender()

type ElementCallback

type ElementCallback func(e *Event)

type Elt

type Elt struct {
	js.Value

	Tag       string
	Attrs     Attrs
	Childs    Elts
	Data      string
	Callbacks map[string]ElementCallback

	LCC LCC
	// contains filtered or unexported fields
}

func NewElt

func NewElt(tag string, mods ...EltMod) *Elt

func (*Elt) AddAttr

func (e *Elt) AddAttr(k, v string)

func (*Elt) Append

func (e *Elt) Append(elts ...*Elt)

func (*Elt) GetPath

func (e *Elt) GetPath(names ...string) js.Value

some access helpers

func (*Elt) GetValue

func (e *Elt) GetValue() string

func (*Elt) Hide

func (e *Elt) Hide()

func (*Elt) Invalidate

func (e *Elt) Invalidate()

func (*Elt) Is

func (e *Elt) Is(target js.Value) bool

func (*Elt) IsHidden

func (e *Elt) IsHidden() bool

func (*Elt) IsVisible

func (e *Elt) IsVisible() bool

func (*Elt) Key

func (e *Elt) Key() string

func (*Elt) Remove

func (e *Elt) Remove(re *Elt)

func (*Elt) RemoveAll

func (e *Elt) RemoveAll()

func (*Elt) Replace

func (e *Elt) Replace(re *Elt, ne *Elt)

func (*Elt) ReplaceCollection

func (e *Elt) ReplaceCollection(new *Elt)

func (*Elt) Show

func (e *Elt) Show()

type EltMod

type EltMod func(e *Elt)

/

func Attr

func Attr(k, v string) EltMod

func Class

func Class(s string) EltMod

func Data

func Data(s string) EltMod

func Hidden

func Hidden(h bool) EltMod

func ID

func ID(s string) EltMod

func Key

func Key(k string) EltMod

func Style

func Style(s string) EltMod

func Type

func Type(s string) EltMod

func Value

func Value(s string) EltMod

type Elts

type Elts []*Elt

type Event

type Event struct {
	// contains filtered or unexported fields
}

func NewEvent

func NewEvent(doc *Document, eventType string, this js.Value, vals []js.Value) (*Event, error)

func (*Event) Args

func (e *Event) Args() []js.Value

func (*Event) Document

func (e *Event) Document() *Document

func (*Event) JSEvent

func (e *Event) JSEvent() js.Value

func (*Event) Target

func (e *Event) Target() js.Value

func (*Event) TargetID

func (e *Event) TargetID() string

func (*Event) This

func (e *Event) This() js.Value

func (*Event) Type

func (e *Event) Type() string

type LCC

type LCC struct {
	// contains filtered or unexported fields
}

func (*LCC) On

func (lcc *LCC) On(evt LCEvent, cb func())

type LCEvent

type LCEvent string
const (
	Mounted   LCEvent = "mounted"
	Unmounted LCEvent = "unmounted"
	Rendered  LCEvent = "rendered"
)

Jump to

Keyboard shortcuts

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