use createDelegate rather than bind, saving implementing our own method of setting a functions scope
This commit is contained in:
parent
dc764b2ad5
commit
4afcae325a
|
@ -74,7 +74,7 @@ Copyright:
|
|||
Ext.each(this.toRegister, function(eventName) {
|
||||
Deluge.Client.web.register_event_listener(eventName);
|
||||
});
|
||||
this.poll = this.poll.bind(this);
|
||||
this.poll = this.poll.createDelegate(this);
|
||||
this.running = setInterval(this.poll, 2000);
|
||||
this.poll();
|
||||
},
|
||||
|
|
|
@ -96,7 +96,7 @@ Ext.deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
|
|||
var str = (config.value.formatter) ? config.value.formatter(config.value.value) : config.value.value;
|
||||
}
|
||||
item.setText(str);
|
||||
}.bind(this);
|
||||
}.createDelegate(this);
|
||||
|
||||
updateStat('connections', {
|
||||
value: {value: stats.num_connections},
|
||||
|
|
|
@ -84,7 +84,7 @@ Deluge.UI = {
|
|||
Deluge.Login.show();
|
||||
}, this, {single: true});
|
||||
|
||||
this.update = this.update.bind(this);
|
||||
this.update = this.update.createDelegate(this);
|
||||
},
|
||||
|
||||
update: function() {
|
||||
|
|
|
@ -38,16 +38,6 @@ Ext.namespace('Ext.deluge');
|
|||
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
||||
|
||||
(function() {
|
||||
/* Add some helper functions to Ext */
|
||||
Ext.apply(Function.prototype, {
|
||||
bind: function(scope) {
|
||||
var self = this;
|
||||
return function() {
|
||||
return self.apply(scope, arguments);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Ext.apply(Ext, {
|
||||
escapeHTML: function(text) {
|
||||
text = String(text).replace('<', '<').replace('>', '>');
|
||||
|
|
Loading…
Reference in New Issue