spago

package module
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: BSD-3-Clause Imports: 4 Imported by: 16

README

SpaGo

Frontend tool-kit for Gopher

Feature

  • No dependencies on other packages.
  • Minimal function set.
  • Distributable as static files(etc.: S3 or GitHub-Pages).
  • Navigation by Location Hash.
  • Mount/Unmount hook.
  • Update WASM when reload on browser.
  • TinyGo supported.
  • Commandline tool included.
  • HTML-like DSL translate to Go-Code.

Install

Library

go env -w GOOS=js GOARCH=wasm
go get github.com/nobonobo/spago
go env -u GOOS GOARCH

Command-line tool

go get github.com/nobonobo/spago/cmd/spago

Getting Started

Getting Started

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PROPS = []string{"value", "selected", "checked", "data"}

PROPS ...

View Source
var (

	// VerboseMode ...
	VerboseMode bool
)

Functions

func AddMeta

func AddMeta(name, content string)

AddMeta add meta tag

func AddStylesheet

func AddStylesheet(url string)

AddStylesheet adds an external stylesheet to the document.

func LoadModule

func LoadModule(names []string, url string) []js.Value

LoadModule equivalent `import {'name1', 'name2', ...} from 'url'`

func LoadModuleAs added in v1.0.4

func LoadModuleAs(name string, url string) js.Value

LoadModuleAs equivalent `import * as 'name' from 'url'`

func LoadScript

func LoadScript(url string)

LoadScript synchronous javascript loader

func Render

func Render(q string, c Component)

Render ...

func RenderBody

func RenderBody(c Component)

RenderBody ...

func Rerender

func Rerender(c Component)

Rerender ...

func S

func S(s ...interface{}) string

S make string from Stringer objects

func SetTitle

func SetTitle(title string)

SetTitle sets the title of the document.

Types

type AttrMap

type AttrMap map[string]interface{}

AttrMap map sttyle attribute markup

type ClassMap

type ClassMap map[string]bool

ClassMap ...

type Component

type Component interface {
	Render() HTML
	// contains filtered or unexported methods
}

Component ...

type ComponentOrHTML

type ComponentOrHTML interface{}

ComponentOrHTML ...

type Core

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

Core ...

type HTML

type HTML interface {
	// contains filtered or unexported methods
}

HTML ...

type Markup

type Markup interface {
	// contains filtered or unexported methods
}

Markup ...

func A

func A(k string, v interface{}) Markup

A attribute markup

func C

func C(c ...Component) Markup

C make Components

func Event

func Event(name string, fn func(ev js.Value)) Markup

Event event markup

func If

func If(cond bool, m Markup) Markup

If ...

func T

func T(s ...interface{}) Markup

T is

func UnsafeHTML added in v1.0.8

func UnsafeHTML(s string) Markup

UnsafeHTML make DOM-Elements from HTML string

type Markups added in v1.0.5

type Markups []Markup

Markups List of Markup type

type Mounter

type Mounter interface {
	Mount()
}

Mounter ...

type Node

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

Node ...

func Tag

func Tag(tag string, markups ...Markup) *Node

Tag markup

func TagNS

func TagNS(namespace, tag string, markups ...Markup) *Node

TagNS markup

type Patches

type Patches []patch

Patches ...

func Diff

func Diff(a, b js.Value) Patches

Diff ...

func (Patches) Do

func (p Patches) Do()

Do ...

type Unmounter

type Unmounter interface {
	Unmount()
}

Unmounter ...

Directories

Path Synopsis
cmd
spago Module
examples
api-app Module
forms Module
pwa Module
simple Module
spa Module
todo Module

Jump to

Keyboard shortcuts

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