Reputation: 1106
According to the Backbone documentation you can use:
object.once(event, callback, [context])
as an alternative to:
object.on(event, callback, [context])
when you want to fire an event only once to a certain object
Why does the following not work:
app.aCollection.once("reset", function() {
console.log("not working");
});
but this does:
app.aCollection.on("reset", function() {
console.log("working");
});
Notice the subtle difference with once and on.
The error I get tells me the object has no once()
method.
aCollection
is a Backbone.js collection object.
How do I get the once()
method working?
Upvotes: 3
Views: 1699