Skip to content

Commit 0ec7583

Browse files
committed
Switch to native Function.prototype.bind
1 parent 4218695 commit 0ec7583

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

frontend/src/modules/projects/views/projectView.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ define(function(require) {
8484
title: Origin.l10n.t('app.' + titleKey),
8585
text: Origin.l10n.t('app.confirmdeleteproject') + '<br/><br/>' + Origin.l10n.t('app.' + textKey),
8686
destructive: isShared,
87-
callback: _.bind(this.deleteProjectConfirm, this)
87+
callback: this.deleteProjectConfirm.bind(this)
8888
});
8989
},
9090

@@ -97,10 +97,10 @@ define(function(require) {
9797

9898
deleteProject: function(event) {
9999
this.model.destroy({
100-
success: _.bind(function() {
100+
success: function() {
101101
Origin.trigger('dashboard:refresh');
102102
this.remove();
103-
}, this),
103+
}.bind(this),
104104
error: function(model, response, options) {
105105
_.delay(function() {
106106
Origin.Notify.alert({ type: 'error', text: response.responseJSON.message });

frontend/src/modules/projects/views/projectsView.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ define(function(require){
2424
},
2525

2626
initEventListeners: function() {
27-
this._doLazyScroll = _.bind(_.throttle(this.doLazyScroll, 250), this);
28-
this._onResize = _.bind(_.debounce(this.onResize, 250), this);
27+
this._doLazyScroll = _.throttle(this.doLazyScroll, 250).bind(this);
28+
this._onResize = _.debounce(this.onResize, 250).bind(this);
2929

3030
this.listenTo(Origin, {
3131
'window:resize dashboard:refresh': this._onResize,
@@ -77,7 +77,7 @@ define(function(require){
7777
}
7878
// we need to load one course first to check page size
7979
this.pageSize = 1;
80-
this.resetCollection(_.bind(function(collection) {
80+
this.resetCollection(function(collection) {
8181
var containerHeight = $(window).height()-this.$el.offset().top;
8282
var containerWidth = this.$('.projects-inner').width();
8383
var itemHeight = $('.project-list-item').outerHeight(true);
@@ -89,7 +89,7 @@ define(function(require){
8989
this.pageSize = columns*rows;
9090
// need another reset to get the actual pageSize number of items
9191
this.resetCollection(this.setViewToReady);
92-
}, this));
92+
}.bind(this));
9393
},
9494

9595
getProjectsContainer: function() {
@@ -136,15 +136,15 @@ define(function(require){
136136
sort: this.sort
137137
}
138138
},
139-
success: _.bind(function(collection, response) {
139+
success: function(collection, response) {
140140
this.isCollectionFetching = false;
141141
this.fetchCount += response.length;
142142
// stop further fetching if this is the last page
143143
if(response.length < this.pageSize) this.shouldStopFetches = true;
144144

145145
this.$('.no-projects').toggleClass('display-none', this.fetchCount > 0);
146146
if(typeof cb === 'function') cb(collection);
147-
}, this)
147+
}.bind(this)
148148
});
149149
},
150150

0 commit comments

Comments
 (0)