Skip to end of metadata
Go to start of metadata

Demonstrates using Backbone events to communicate between view-controllers.

App Folder Location

Icon

alloy/test/apps/basics/controller_events

The main XML view consists of a TextField and two buttons, labeled "Fire Event" and "Remove Listener". When the user clicks "Fire Event" the required CustomView view-controller uses the Backbone library's  trigger()  method to generate an event named someEvent. The event object includes a field named message field that contains the text entered in the TextField.

app/controllers/CustomView.js

The main application view-controller binds a callback function named handler to the someEvent event, and displays the message enter in the TextField. It also provides a button that un-binds the handler from the same event.

app/controllers/index.js

See Also