this._repaintLoop = () => {
            ReactUpdates.flushBatchedUpdates();
            if (this._hasDomChanges) {
                this._hasDomChanges = false;
                this.emit('update');
            }

            if (this._isLoopAlive) {
                requestAnimationFrame(this._repaintLoop);
            }
        };
示例#2
0
  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)
    );
  }
示例#3
0
const tick = () => {
  ReactUpdates.flushBatchedUpdates();
  raf(tick);
}
function tick() {
  ReactUpdates.flushBatchedUpdates();
  requestAnimationFrame(tick);
}