Skip to content

Instantly share code, notes, and snippets.

@soylent-grin
Last active November 24, 2015 19:14
Show Gist options
  • Save soylent-grin/222a6442d414f8c91545 to your computer and use it in GitHub Desktop.
Save soylent-grin/222a6442d414f8c91545 to your computer and use it in GitHub Desktop.
Batched Component
...
lock() {
if (this._lockTimeout) {
clearTimeout(this._lockTimeout);
}
this.locked = true;
this._lockTimeout = setTimeout(() => { this.locked = false; }, LOCK_TIMEOUT);
}
componentDidUpdate() {
this.lock();
}
shouldComponentUpdate() {
return this.locked;
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment