diff --git a/examples/image-load-events.js b/examples/image-load-events.js index 293810f89f..885556aff3 100644 --- a/examples/image-load-events.js +++ b/examples/image-load-events.js @@ -33,10 +33,11 @@ Progress.prototype.addLoading = function() { * Increment the count of loaded tiles. */ Progress.prototype.addLoaded = function() { + var this_ = this; setTimeout(function() { - ++this.loaded; - this.update(); - }.bind(this), 100); + ++this_.loaded; + this_.update(); + }, 100); }; @@ -49,7 +50,10 @@ Progress.prototype.update = function() { if (this.loading === this.loaded) { this.loading = 0; this.loaded = 0; - setTimeout(this.hide.bind(this), 500); + var this_ = this; + setTimeout(function() { + this_.hide(); + }, 500); } }; diff --git a/examples/tile-load-events.js b/examples/tile-load-events.js index df10f4575e..b6610b0327 100644 --- a/examples/tile-load-events.js +++ b/examples/tile-load-events.js @@ -33,10 +33,11 @@ Progress.prototype.addLoading = function() { * Increment the count of loaded tiles. */ Progress.prototype.addLoaded = function() { + var this_ = this; setTimeout(function() { - ++this.loaded; - this.update(); - }.bind(this), 100); + ++this_.loaded; + this_.update(); + }, 100); }; @@ -49,7 +50,10 @@ Progress.prototype.update = function() { if (this.loading === this.loaded) { this.loading = 0; this.loaded = 0; - setTimeout(this.hide.bind(this), 500); + var this_ = this; + setTimeout(function() { + this_.hide(); + }, 500); } };