mithril

package
v0.0.0-...-b7787a3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2016 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildQueryString

func BuildQueryString(object *js.M) string

BuildQueryString serializes an object into its URI encoded querystring representation.

func Component

func Component(component *js.Object, args ...*js.Object) *js.Object

Component initializes a Component object by parametrizing it with args.

func Deferred

func Deferred() *js.Object

Deferred constructs a modified deferred object.

func Deps

func Deps(window *js.Object) *js.Object

Deps is used in testing to replace the default window object on which Mithril depends.

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

func M(selector string, attrs js.M, children ...interface{}) *js.Object

M composes virtual elements that can be rendered via Render(). The variable parameter children must be either strings or other virtual elements.

func Mount

func Mount(root *js.Object, element interface{}) *js.Object

Mount "hooks up" an element for continuous rendering at a target node.

func ParseQueryString

func ParseQueryString(queryString string) *js.Object

ParseQueryString deserializes an object from its URI encoded querystring representation.

func Prop

func Prop(store *js.Object) *js.Object

Prop creates a getter/setter function. store is the initial value.

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

func RedrawStrategy(strategy ...string) string

RedrawStrategy sets the strategy of redrawing, to either "all", "diff", or "none". Call with one or no arguments.

func Render

func Render(root *js.Object, cell interface{}, force bool)

Render renders a given virtual element cell to a DOM Node. Iff force is true, this will force the recreation of elements.

func Request

func Request(options js.M) *js.Object

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 RouteConfig() *js.Object

func RouteDefine

func RouteDefine(rootElement *js.Object, defaultRoute string, routes js.M) *js.Object

RouteDefine allows you to define the routes for a Single-Page Application.

func RouteMode

func RouteMode(mode ...string) string

Property for getting and setting the route mode. Call with 0 or 1 arguments

func RouteParam

func RouteParam(param string) interface{}

func RouteRedirect

func RouteRedirect(path string, params js.M, replaceHistory bool)

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.

func Sync

func Sync(args ...*js.Object) *js.Object

Sync composes an array of promises into one promise.

func Trust

func Trust(trusted string) *js.Object

Trust annotates a string as trusted, so that HTML entities will not be escaped.

func Version

func Version() string

Version returns the version of the underlying Mithril library.

func WithAttr

func WithAttr(args ...interface{}) *js.Object

WithAttr is an event handler factory. It returns a method that can be bound to a DOM element's event listener, to implement databinding from the view to the model.

Types

This section is empty.

Directories

Path Synopsis
Package mtest implements functions for testing mithril components.
Package mtest implements functions for testing mithril components.

Jump to

Keyboard shortcuts

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