this._repaintLoop = () => { ReactUpdates.flushBatchedUpdates(); if (this._hasDomChanges) { this._hasDomChanges = false; this.emit('update'); } if (this._isLoopAlive) { requestAnimationFrame(this._repaintLoop); } };
handleSyntaxClick(syntax) { this.setState({ syntax, chosen: true }); const scrollTopBefore = findDOMNode(this).getBoundingClientRect().top; setPreferredSyntax(syntax); ReactUpdates.flushBatchedUpdates(); const scrollTopAfter = findDOMNode(this).getBoundingClientRect().top; window.scroll( window.pageXOffset || window.scrollX, (window.pageYOffset || window.scrollY) - (scrollTopBefore - scrollTopAfter) ); }
const tick = () => { ReactUpdates.flushBatchedUpdates(); raf(tick); }
function tick() { ReactUpdates.flushBatchedUpdates(); requestAnimationFrame(tick); }