How to use the event-emitter/all-off function in event-emitter

To help you get started, we’ve selected a few event-emitter 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 storybookjs / storybook / examples / rax-kitchen-sink / src / components / Logger.js View on Github external
componentWillUnmount() {
    const { emitter } = this.props;

    allOff(emitter);
  }
github yusukeshibata / react-pullrefresh / src / pullhelper / index.js View on Github external
unload() {
    if(!this._scrollElement) return this
    this._loaded = false
    allOff(this._emitter)
    this._scrollElement.removeScrollEventListener(this.onScroll)
    this._scrollElement.removeEventListener('touchstart', this.onTouchStart)
    this._scrollElement.removeEventListener('touchmove', this.onTouchMove)
    this._scrollElement.removeEventListener('touchend', this.onTouchEnd)
    this._scrollElement.removeEventListener('mousedown', this.onTouchStart)
    this._scrollElement.removeEventListener('mousemove', this.onTouchMove)
    this._scrollElement.removeEventListener('mouseleave', this.onTouchEnd)
    this._scrollElement.removeEventListener('mouseup', this.onTouchEnd)
    return this
  }
  render(children) {
github risq / transceiver / src / channel.js View on Github external
reset() {
    this.dbg(`Resetting channel`);
    this.requestHandlers = {};
    allOff(this.emitter);
    return this;
  }
};