wade

package module
v0.0.0-...-f2091f6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2015 License: BSD-2-Clause Imports: 11 Imported by: 4

README

Wade.Go

Wade.Go is an upcoming brand new way to develop web sites and applications. It's a client-centric web development library, but NOT for Javascript!

Isomorphic Javascript is cool but what could be better than that? Isomorphic Go.
Advantages:

  • Isomorphism: Write ui/client once, in Go and HTML, render seemlessly on both client and server (no SEO problems). Go code is transpiled to Javascript on browser.
  • Pleasure: Modern React-like development model, in Go (strict types ftw!).
  • Maintainability: No more maintainability headache like with Javascript, and we could go easy on tests. It helps tremendously to have strict typing and a nice compiler, especially for large projects.
  • Convenience: Easy collaboration between client and server since they use the same great programming language.

Development Status

  • Mar 12, 2015: Iteration 5 starts.
  • May 03, 2015: Core rendering and template/component functionalities working. Still early stage, not yet have end-to-end tests for the DOM diff engine.

Run the test app

Make sure you have a working Go installation and Gopherjs, then

  1. go get -u github.com/gowade/wade
  2. Install fuel the code generator: go install github.com/gowade/wade/fuel
  3. Go to "browser_tests/worklog/main", run fuel build, then run ./run_gopherjs
  4. Use browser to open the file browser_tests/worklog/main/public/index.html

LICENSE

Wade.Go is BSD licensed

Documentation

Overview

+build js

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientSide

func ClientSide() bool

func DevMode

func DevMode() bool

func FindContainer

func FindContainer(query string) dom.Node

func If

func If(cond bool, v string) string

func InitApp

func InitApp(basepath string, router driver.Router, container dom.Node)

func MergeMaps

func MergeMaps(m1, m2 map[string]interface{}) map[string]interface{}

func NewVNodeList

func NewVNodeList(nodes ...interface{}) []vdom.VNode

func QueryEscape

func QueryEscape(str string) string

func Route

func Route(routeName string, params ...interface{}) string

func SetMode

func SetMode(appMode AppMode)

func Str

func Str(value interface{}) string

func WrapEvt

func WrapEvt(handler func(dom.Event)) interface{}

Types

type AppMode

type AppMode int
const (
	DevelopmentMode AppMode = iota
	ProductionMode
)

type Application

type Application struct {
	BasePath  string
	Router    driver.Router
	Container dom.Node
}

func App

func App() Application

func (Application) SetURLPath

func (z Application) SetURLPath(newPath string)

type Component

type Component interface{}

type Context

type Context struct {
	Params RouteParams
	URL    *gourl.URL
	// contains filtered or unexported fields
}

Context provides access to page data and page operations inside a controller function

func (*Context) GoToRemoteURL

func (c *Context) GoToRemoteURL(destURL string) error

func (*Context) GoToRoute

func (c *Context) GoToRoute(routeName string, params ...interface{}) error

func (*Context) Render

func (c *Context) Render(component vdom.Component) error

type ControllerFunc

type ControllerFunc func(*Context) error

type DefaultRouter

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

func NewRouter

func NewRouter() *DefaultRouter

func (*DefaultRouter) Build

func (r *DefaultRouter) Build()

func (*DefaultRouter) Handle

func (r *DefaultRouter) Handle(route string, routeName string, handler ControllerFunc)

Handle registers a handler for the given route, routeName is a unique name that you assign to a route, to be used in links for example

func (*DefaultRouter) Lookup

func (r *DefaultRouter) Lookup(path string) (interface{}, map[string]string)

func (*DefaultRouter) PathFromRoute

func (r *DefaultRouter) PathFromRoute(route string, params ...interface{}) string

func (*DefaultRouter) Render

func (r *DefaultRouter) Render(url *gourl.URL)

func (*DefaultRouter) RouteByName

func (r *DefaultRouter) RouteByName(routeName string) (route string, ok bool)

func (*DefaultRouter) SetErrorHandler

func (r *DefaultRouter) SetErrorHandler(handler func(error))

func (*DefaultRouter) SetNotFoundHandler

func (r *DefaultRouter) SetNotFoundHandler(c ControllerFunc)

type M

type M map[string]interface{}

type RouteParams

type RouteParams map[string]string

RouteParams holds the values of named parameters for a route

func (RouteParams) Get

func (rp RouteParams) Get(param string) string

Get returns the string value of the given named parameter

func (RouteParams) ScanTo

func (rp RouteParams) ScanTo(dest interface{}, param string)

ScanTo uses fmt.Sscan to scan the value of the given named parameter to a pointer.

Jump to

Keyboard shortcuts

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