The .on()
method expects you to pass the callback function or method that will be called to handle the event. But in your first example you tried to pass a result of that callback.
So inside it will execute yourCallback.call(...)
or yourCallback.apply(...)
. Obviously it could not execute the .call()
method of non-function value.
But you can wrap the method call in anonymous function though if you really need it. For example if you need to use that someParameter
value:
var MyView = Backbone.View.extend({
// ...
myMethod: function(someParameter) {
this.model.on('change:attribute', function() {
functionName(someParameter);
});
}
});