How to use the gl-react.Visitors.add function in gl-react

To help you get started, we’ve selected a few gl-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gre / gl-react / packages / cookbook / src / Inspector / index.js View on Github external
onVisitorLoggerChange = (e: *) => {
    Visitors.remove(inspectorVisitorLogger);
    if (e.target.checked) {
      Visitors.add(inspectorVisitorLogger);
    }
  };
github gre / gl-react / packages / cookbook / src / Inspector / index.js View on Github external
componentDidMount() {
    Visitors.add(this);
    this._startupTimeout = setTimeout(() => this.detectSurface(), 0);
    let lastT;
    const loop = t => {
      this._raf = raf(loop);
      if (!lastT) lastT = t;
      const delta = Math.min(100, t - lastT);
      lastT = t;
      const syncChanged = this.syncFromDom();
      const physicsChanged = this.state.physics && this.physicsStep(delta);
      if (syncChanged || physicsChanged) {
        this.forceUpdate();
      }
    };
    this._raf = raf(loop);
  }