Skip to content

Commit 82bf61e

Browse files
authored
Merge pull request #4146 from rafde/lodash5-compat
`_.bind` to `Function.prototype.bind`
2 parents 06fd17a + 2276b8d commit 82bf61e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

backbone.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,15 @@
273273
// once for each event, not once for a combination of all events.
274274
Events.once = function(name, callback, context) {
275275
// Map the event into a `{event: once}` object.
276-
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));
276+
var events = eventsApi(onceMap, {}, name, callback, this.off.bind(this));
277277
if (typeof name === 'string' && context == null) callback = void 0;
278278
return this.on(events, callback, context);
279279
};
280280

281281
// Inversion-of-control versions of `once`.
282282
Events.listenToOnce = function(obj, name, callback) {
283283
// Map the event into a `{event: once}` object.
284-
var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));
284+
var events = eventsApi(onceMap, {}, name, callback, this.stopListening.bind(this, obj));
285285
return this.listenTo(obj, events);
286286
};
287287

@@ -1030,7 +1030,7 @@
10301030
options || (options = {});
10311031

10321032
var length = comparator.length;
1033-
if (_.isFunction(comparator)) comparator = _.bind(comparator, this);
1033+
if (_.isFunction(comparator)) comparator = comparator.bind(this);
10341034

10351035
// Run sort based on type of `comparator`.
10361036
if (length === 1 || _.isString(comparator)) {
@@ -1389,7 +1389,7 @@
13891389
if (!_.isFunction(method)) method = this[method];
13901390
if (!method) continue;
13911391
var match = key.match(delegateEventSplitter);
1392-
this.delegate(match[1], match[2], _.bind(method, this));
1392+
this.delegate(match[1], match[2], method.bind(this));
13931393
}
13941394
return this;
13951395
},
@@ -1744,7 +1744,7 @@
17441744
// falls back to polling.
17451745
var History = Backbone.History = function() {
17461746
this.handlers = [];
1747-
this.checkUrl = _.bind(this.checkUrl, this);
1747+
this.checkUrl = this.checkUrl.bind(this);
17481748

17491749
// Ensure that `History` can be used outside of the browser.
17501750
if (typeof window !== 'undefined') {

0 commit comments

Comments
 (0)