When using JavaScript native events, I’m use to using
element.addEventListener(named_event, callback);
In the backbone api for events, it looks quite different.
In the example they use, the event is called “alert”.
object.on("alert", function(msg) {
alert("Triggered " + msg);
});
Is there a subset of names you can use for events, or can you use any name you choose?
It appears there is both open naming and a ‘catalog’ of special event names further down in the documentation.
Catalog of Events
You can find complete list of built-in Backbone events, with arguments in Backbone.js docs#Events-catalog. You’re also free to trigger your own events on Models, Collections and Views as you see fit. The Backbone object itself mixes in Events, and can be used to emit any global events that your application needs.