Backbone Versus Listening Events

I'm new to Backbone and confused about the difference between hash events {} and listenTo you put in the initialize method. Why are you using one over the other. Is the event hash hash initialized?

+3


source to share


1 answer


events

used to attach event listeners to DOM elements. Backbone uses the event delegation method to bind handlers behind the scenes.



listenTo

is used to listen for Backbone related events and you don't need to use it in the context of a function initialize

. For example, you can use a method listenTo

on the View object to listen for an event on change

the Backbone collection.

+8


source







All Articles