How to use good-listener - 7 common examples

To help you get started, we’ve selected a few good-listener 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 zhw2590582 / 100plugins / 08-crop.js / src / js / index.js View on Github external
_cropModalEvent(e){
    e.preventDefault();
    console.log(e.pageX, this.config.imgLeft);
    this.config.X = e.pageX - this.config.imgLeft;
    this.config.Y = e.pageY - this.config.imgTop;
    this.config.cache = { x: e.pageX, y: e.pageY };
    this.listenList._cropModalMove = listen(document.body, 'mousemove', this._cropModalMove);
    this.listenList._cropModalMouseup = listen(document.body, 'mouseup', this._cropModalMouseup);
  }
github zhw2590582 / 100plugins / 10-validate.js / src / js / index.js View on Github external
_formSubmit(){
    let _validate = e => {
      e && e.preventDefault();
      this._validate(true);
      this._validateState();
      this.options.focusError && this._focus();
      let flag = Object.keys(this.config.validateState).every(item => {
        return this.config.validateState[item]
      });
      flag && this.options.submitHandler(this.options.container);
    }
    listen(this.options.container, 'submit', _validate);
  }
github zhw2590582 / 100plugins / 10-validate.js / src / js / index.js View on Github external
} else if (item.value > rule.max) {
          this._errorMsg(item, rule.message || this.options.errorMsg.maxMsg(rule.max));
        } else {
          this._removeError(item);
        }
      } else if (rule.regex) {
        if(this.config.errorDom[item.name]) return;
        if(!new RegExp(rule.regex).test(item.value)){
          this._errorMsg(item, rule.message || this.options.errorMsg.regexMsg(rule.regex));
        } else {
          this._removeError(item);
        }
      }
    }

    submit && _event() || listen(item, rule.trigger, _event);
  }
github zhw2590582 / 100plugins / 08-crop.js / src / js / index.js View on Github external
_eventBind(){
    this.listenList._cropModalEvent = listen(this.cropModal, 'mousedown', this._cropModalEvent);
    this.listenList._cropBoxEvent = listen(this.cropModal, 'mousedown', this._cropBoxEvent);
  }
github zhw2590582 / 100plugins / 09-pullrefresh.js / src / js / index.js View on Github external
_listen(el, type, event) {
    this.listeners.push(listen(el, type, event));
  }
}
github abhishekbalam / keeplinkin / keeplinkin / static / js / clipboard.js-master / src / clipboard.js View on Github external
listenClick(trigger) {
        this.listener = listen(trigger, 'click', (e) => this.onClick(e));
    }
github zenorocha / clipboard.js / src / clipboard.js View on Github external
listenClick(trigger) {
        this.listener = listen(trigger, 'click', (e) => this.onClick(e));
    }

good-listener

A more versatile way of adding & removing event listeners

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Popular good-listener functions