Documentation ¶
Overview ¶
Package mithril exports explicit bindings for the Mithril Javascript Library. This version targets v 0.2.3 of the Mithril API. See http://mithril.js.org/mithril.html These bindings assume that the correct Mithril script has already been loaded into the Global namespace before init() is called.
Index ¶
- func BuildQueryString(object *js.M) string
- func Component(component *js.Object, args ...*js.Object) *js.Object
- func Deferred() *js.Object
- func Deps(window *js.Object) *js.Object
- func EndComputation()
- func M(selector string, attrs js.M, children ...interface{}) *js.Object
- func Mount(root dom.Node, element interface{}) *js.Object
- func ParseQueryString(queryString string) *js.Object
- func Prop(store *js.Object) *js.Object
- func Redraw(force bool)
- func RedrawStrategy(strategy ...string) string
- func Render(root dom.Node, cell interface{}, force bool)
- func Request(options js.M) *js.Object
- func Route() string
- func RouteConfig() *js.Object
- func RouteDefine(rootElement dom.Node, defaultRoute string, routes js.M) *js.Object
- func RouteMode(mode ...string) string
- func RouteParam(param string) interface{}
- func RouteRedirect(path string, params js.M, replaceHistory bool)
- func StartComputation()
- func Sync(args ...*js.Object) *js.Object
- func Trust(trusted string) *js.Object
- func Version() string
- func WithAttr(args ...interface{}) *js.Object
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildQueryString ¶
BuildQueryString serializes an object into its URI encoded querystring representation.
func EndComputation ¶
func EndComputation()
EndComputation is used in conjuction with StartComputation to signal to Mithril when asynchronous work has been completed, and a redraw should happen.
func M ¶
M composes virtual elements that can be rendered via Render(). The variable parameter children must be either strings or other virtual elements.
func ParseQueryString ¶
ParseQueryString deserializes an object from its URI encoded querystring representation.
func Redraw ¶
func Redraw(force bool)
Redraw requests an aggressive redraw of the view. This redraw happens even if there are pending AJAX requests or other async requests, so make sure templates have null checks in place to account for this. Redraws will not occur if a redraw is currently in progress.
func RedrawStrategy ¶
RedrawStrategy sets the strategy of redrawing, to either "all", "diff", or "none". Call with one or no arguments.
func Render ¶
Render renders a given virtual element cell to a DOM Node. Iff force is true, this will force the recreation of elements.
func Request ¶
Create an asynchronous HTTP request to some url. Returns a deferred prop that can be invoked to get the correct value.
func Route ¶
func Route() string
Route returns the current route. If you're looking for bindings to the other Mithril "route" methods, look at RouteDefine, RouteMode and RouteRedirect. RouteAbstraction has not been implemented so far.
func RouteConfig ¶
func RouteDefine ¶
RouteDefine allows you to define the routes for a Single-Page Application.
func RouteParam ¶
func RouteParam(param string) interface{}
func RouteRedirect ¶
RouteRedirect automatically and programmatically allows you to redirect to a given route.
func StartComputation ¶
func StartComputation()
StartComputation is used in conjuction with EndComputation to signal to Mithril when asynchronous work has been completed, and a redraw should happen.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
deferred
This package shows the deferred API in action.
|
This package shows the deferred API in action. |
todo
A simple MVC TODO app implemented using Moria.
|
A simple MVC TODO app implemented using Moria. |
Package moria contains idiomatic Go data types and helper functions for defining Mithril components within Go.
|
Package moria contains idiomatic Go data types and helper functions for defining Mithril components within Go. |