setInterval 行应该像这样:

```javascript

this.intervalID = setInterval( (function(self) { //Self-executing func which takes 'this' as self return function() { //Return a function in the context of 'self' self.retrieve_rate(); //Thing you wanted to run as non-window 'this' } })(this), this.INTERVAL //normal interval, 'this' scope not impacted here. );

```

onload

```javascript

retrieve_rate : function() { var self = this; var ajax = new XMLHttpRequest(); ajax.open('GET', 'http://xyz.com', true); ajax.onreadystatechanged = function() { if (ajax.readyState == 4 && ajax.status == 200) { // prefs available as self.prefs } } ajax.send(null); }

```