Documentation
¶
Overview ¶
Package controller manages bindings with a model, and provides mutation methods
Index ¶
- Variables
- type Controller
- func (c *Controller) BindAction(element, action string) error
- func (c *Controller) BindActions(pairs ...string) error
- func (c *Controller) BindValues(name string, formID string, elements []string, source observable.Source) error
- func (c *Controller) HandleActions(handler func(action string))
- func (c *Controller) Release()
Constants ¶
This section is empty.
Variables ¶
var (
ErrBadPair = errors.New("bad pair")
)
Functions ¶
This section is empty.
Types ¶
type Controller ¶
Controller handles the interaction of observable bindings between the model and the browser. It also handles action bindings with clickable objects.
func New ¶
New creates a new Controller instance given the web server's RPC service and a connection to the browser. namespace specifies the browser's binding namespace to use with this Controller's instance.
func Start ¶
func Start(ctx context.Context, ws *websocket.Conn) (c *Controller, done <-chan struct{}, err error)
Start starts server side rpc and creates a Controller. wait on the returned channel after creating your bindings.
func (*Controller) BindAction ¶
func (c *Controller) BindAction(element, action string) error
BindAction creates an action binding. Call HandleActions first.
func (*Controller) BindActions ¶
func (c *Controller) BindActions(pairs ...string) error
BindActions calls BindAction with multiple pairs of element,action as a convenience
func (*Controller) BindValues ¶
func (c *Controller) BindValues( name string, formID string, elements []string, source observable.Source, ) error
BindValues creates value bindings.
func (*Controller) HandleActions ¶
func (c *Controller) HandleActions(handler func(action string))
HandleActions sets the callback for actions