on function

Helper for subscriptions.

@param {Object|EventEmitter} obj with Emitter mixin or EventEmitter @param {String} event name @param {Function} callback @api public

Implementation

Destroyable on(EventEmitter obj, String ev, EventHandler fn) {
  obj.on(ev, fn);
  return Destroyable(() => obj.off(ev, fn));
}