Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes unnecessary fourth parameters to Events methods #929

Merged
merged 1 commit into from
Feb 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Removes unnecessary fourth parameters to Events methods
listenTo and stopListening don’t accept a fourth parameter for the
context; it’s set automatically for you.
  • Loading branch information
jamesplease committed Feb 21, 2014
commit ecd7ac300046a88e60dd5598c3ceff762c5602ae
8 changes: 4 additions & 4 deletions src/marionette.bindEntityEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
throwError("Method '"+ methodName +"' was configured as an event handler, but does not exist.");
}

target.listenTo(entity, evt, method, target);
target.listenTo(entity, evt, method);
});
}

// Bind the event to a supplied callback function
function bindToFunction(target, entity, evt, method){
target.listenTo(entity, evt, method, target);
target.listenTo(entity, evt, method);
}

// Bind the event to handlers specified as a string of
Expand All @@ -45,13 +45,13 @@

_.each(methodNames,function(methodName) {
var method = target[methodName];
target.stopListening(entity, evt, method, target);
target.stopListening(entity, evt, method);
});
}

// Bind the event to a supplied callback function
function unbindToFunction(target, entity, evt, method){
target.stopListening(entity, evt, method, target);
target.stopListening(entity, evt, method);
}


Expand Down
6 changes: 3 additions & 3 deletions src/marionette.collectionview.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ Marionette.CollectionView = Marionette.View.extend({
// binds to.
_initialEvents: function(){
if (this.collection){
this.listenTo(this.collection, "add", this.addChildView, this);
this.listenTo(this.collection, "remove", this.removeItemView, this);
this.listenTo(this.collection, "reset", this.render, this);
this.listenTo(this.collection, "add", this.addChildView);
this.listenTo(this.collection, "remove", this.removeItemView);
this.listenTo(this.collection, "reset", this.render);
}
},

Expand Down
6 changes: 3 additions & 3 deletions src/marionette.compositeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ Marionette.CompositeView = Marionette.CollectionView.extend({
// to unexisting itemViewContainer
this.once('render', function () {
if (this.collection){
this.listenTo(this.collection, "add", this.addChildView, this);
this.listenTo(this.collection, "remove", this.removeItemView, this);
this.listenTo(this.collection, "reset", this._renderChildren, this);
this.listenTo(this.collection, "add", this.addChildView);
this.listenTo(this.collection, "remove", this.removeItemView);
this.listenTo(this.collection, "reset", this._renderChildren);
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/marionette.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Marionette.View = Backbone.View.extend({
Backbone.View.prototype.constructor.apply(this, args);

Marionette.MonitorDOMRefresh(this);
this.listenTo(this, "show", this.onShowCalled, this);
this.listenTo(this, "show", this.onShowCalled);
},

// import the "triggerMethod" to trigger events with corresponding
Expand Down