Example #1
0
// Mount takes a Component, converts (or creates) the appropriate mithril
// representation, and then calls it.
func Mount(root dom.Node, component Component) {
	fauxComponent := js.M{
		"view":       component.View,
		"controller": component.Controller,
	}
	m.Mount(root, fauxComponent)
}
Example #2
0
func main() {
	example := dom.GetWindow().Document().GetElementByID("example")
	m.Mount(
		example,
		js.M{
			"view":       js.MakeFunc(View),
			"controller": js.MakeFunc(Controller)},
	)
}