How to use the component-emitter.call function in component-emitter

To help you get started, we’ve selected a few component-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 micromatch / glob-fs / index.js View on Github external
function Glob(options) {
  if (!(this instanceof Glob)) {
    return new Glob(options);
  }

  Emitter.call(this);
  this.handler = new Handler(this);
  this.init(options);
}
github enquirer / prompt-base / index.js View on Github external
function Prompt(question, answers, ui) {
  debug('initializing from <%s>', __filename);

  if (!question) {
    throw new TypeError('expected question to be a string or object');
  }

  if (!(this instanceof Prompt)) {
    var proto = Object.create(Prompt.prototype);
    Prompt.apply(proto, arguments);
    return proto;
  }

  Emitter.call(this);
  if (!(question instanceof Question)) {
    question = new Question(question);
  }

  this.question = this.options = question;
  this.answers = answers || {};
  this.context = {};
  this.contextHistory = [];
  this.actions = new Actions(this);

  if (typeof this.options.limit !== 'number') {
    this.options.limit = this.options.radio ? 9 : 7;
  }

  this.ui = ui || UI.create(this.options);
  this.rl = this.ui.rl;
github component / tip / index.js View on Github external
function Tip(content, options) {
  options = options || {};
  if (!(this instanceof Tip)) return tip(content, options);
  Emitter.call(this);
  this.classname = '';
  this.delay = options.delay || 300;
  this.pad = null == options.pad ? 15 : options.pad;
  this.el = html.cloneNode(true);
  this.events = events(this.el, this);
  this.classes = classes(this.el);
  this.reposition = bind( this, Tip.prototype.reposition );
  this.inner = query('.tip-inner', this.el);
  this.message(content);
  this.position('top');
  this.static = !!options.static;
  if (Tip.effect) this.effect(Tip.effect);
}
github jonschlinkert / template / lib / loaders.js View on Github external
function Loaders(options) {
  Emitter.call(this);
  this.options = options || {};
  this.iterators = this.iterators || {};
}
github doowb / composer / lib / schedule.js View on Github external
function Schedule (runner, tasks) {
  Emitter.call(this);
  this.running = false;
  this.define('_callbacks', this._callbacks || {});
  this.define('runner', runner);
  this.define('tasks', tasks);
  this.define('history', []);
  this.define('_handlers', {});
}

component-emitter

Simple event emitter

MIT
Latest version published 1 year ago

Package Health Score

77 / 100
Full package analysis