I need to access this
from my setInterval
handler
prefs: null,
startup : function()
{
// init prefs
...
With improving browser support the time is now good to use the EcmaScript 6 enhancement, the arrow => method, to preserve this
properly.
startup : function()
{
// init prefs
...
this.retrieve_rate();
this.intervalID = setInterval( () => this.retrieve_rate(), this.INTERVAL);
},
Using => method preserves the this
when retrieve_rate()
is called by the interval. No need for funky self or passing this
in parameters