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) {
|
Ext.each(this.toRegister, function(eventName) {
|
||||||
Deluge.Client.web.register_event_listener(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.running = setInterval(this.poll, 2000);
|
||||||
this.poll();
|
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;
|
var str = (config.value.formatter) ? config.value.formatter(config.value.value) : config.value.value;
|
||||||
}
|
}
|
||||||
item.setText(str);
|
item.setText(str);
|
||||||
}.bind(this);
|
}.createDelegate(this);
|
||||||
|
|
||||||
updateStat('connections', {
|
updateStat('connections', {
|
||||||
value: {value: stats.num_connections},
|
value: {value: stats.num_connections},
|
||||||
|
|
|
@ -84,7 +84,7 @@ Deluge.UI = {
|
||||||
Deluge.Login.show();
|
Deluge.Login.show();
|
||||||
}, this, {single: true});
|
}, this, {single: true});
|
||||||
|
|
||||||
this.update = this.update.bind(this);
|
this.update = this.update.createDelegate(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
|
|
|
@ -38,16 +38,6 @@ Ext.namespace('Ext.deluge');
|
||||||
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
||||||
|
|
||||||
(function() {
|
(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, {
|
Ext.apply(Ext, {
|
||||||
escapeHTML: function(text) {
|
escapeHTML: function(text) {
|
||||||
text = String(text).replace('<', '<').replace('>', '>');
|
text = String(text).replace('<', '<').replace('>', '>');
|
||||||
|
|
Loading…
Reference in New Issue