We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After calling a function through setTimeOut inside a Polymer element, 'this' no longer points to the custom element but to the window. Demo below.
http://jsbin.com/hehafo/2/edit?html,console,output
The text was updated successfully, but these errors were encountered:
use
setTimeout(this.delayed.bind(this),100);
or
this.async(this.delayed,100);
instead
Sorry, something went wrong.
Third method:
setTimeout(function() { this.delayed(); }.bind(this), 100);
Yep, this is what async() is for. If you want to use setTimeout, you'll need to bind this. Just scoping ftw!
async()
setTimeout
this
No branches or pull requests
After calling a function through setTimeOut inside a Polymer element, 'this' no longer points to the custom element but to the window. Demo below.
http://jsbin.com/hehafo/2/edit?html,console,output
The text was updated successfully, but these errors were encountered: