lib/events.js
function once(emitter, eventName, handler, context) {
  handler = context ? handler.bind(context) : handler;
  let wrapper = function onceHandler(event) {
    emitter.removeEventListener(eventName, onceHandler);
    handler(event);
  };
  emitter.addEventListener(eventName, wrapper);
  return wrapper;
}
function once(emitter, eventName, handler, context) {
  handler = context ? handler.bind(context) : handler;
  let wrapper = function onceHandler(event) {
    emitter.removeEventListener(eventName, onceHandler);
    handler(event);
  };
  emitter.addEventListener(eventName, wrapper);
  return wrapper;
}
function once ( emitter , eventName , handler , context ) { handler = context ? handler . bind ( context ) : handler ; let wrapper = function onceHandler ( event ) { emitter . removeEventListener ( eventName , onceHandler ) ; handler ( event ) ; } ; emitter . addEventListener ( eventName , wrapper ) ; return wrapper ; }
Register to receive one single event.
Register to receive one single event .