Reputation: 4293
I have a javascript object (that is instantiated several times) that contains setTimeout
functions. The function is similar to this:
setTimeout(function() {
this.function();
}.bind(this), this.interval);
This works fine on all browsers except for Mobile Safari. During my tests on what happened, the error is the result of adding .bind(this)
to the end of the function declaration in the setTimeout
. Although it works when I remove the .bind(this)
in Safari, it stops working on other browsers... Does anyone how I could fix this?
Upvotes: 1
Views: 1262
Reputation: 86
Apparently no versions of mobile Safari support function.bind. MDN does provide a polyfill for it though.
Upvotes: 4