Skip to content

Instantly share code, notes, and snippets.

@tuckbick
Last active March 3, 2017 16:14
Show Gist options
  • Save tuckbick/dfa7ff8c949813f895f514856ef9cd8b to your computer and use it in GitHub Desktop.
Save tuckbick/dfa7ff8c949813f895f514856ef9cd8b to your computer and use it in GitHub Desktop.
render() {
// ...
// It can 20-30 milliseconds for CSS to be applied to the newly
// inserted DOM. This attempts to wait for that.
// Gives up after 200 * 10 milliseconds = 2 seconds to be safe.
interval = window.setInterval(() => {
intervalAttempts++;
if (intervalAttempts > 200 || view.$el.height() > 1) {
clearInterval(interval);
view.afterRender();
}
}, 10);
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment