useful when defining services! note: has EventEmitter.once semantics if using .on('ready',fn) it will be be called for each ready event
182632
function api_ready(ready) {
    var self = this

    if ('function' === typeof ready) {
      setImmediate(function register_ready() {
        if (root$.private$.ge.isclear()) {
          execute_ready(ready.bind(self))
        } else {
          root$.private$.ready_list.push(ready.bind(self))
        }
      })
    }

    return self
  }
1086934
function ready (fn) {
  if (isReady()) {
    return fn()
  } else if (document.addEventListener) {
    document.addEventListener('DOMContentLoaded', fn)
  } else {
    document.attachEvent('onreadystatechange', function () {
      if (isReady()) fn()
    })
  }
}
452427
function on(evt, handler) {
            var _this = this;

            var thisArg = arguments[2] === undefined ? null : arguments[2];

            // if multiple events are passed, call our utility method `eachEvt` to deal with this.
            // if it returns `true`, we should exit, because we're actually being called recursively.
            // If it returns `false`, we're not being called with multiple parameters (this time, anyway),
            // and so can continue processing.
            if (eachEvt(evt, handler, thisArg, function () {
                for (var _len2 = arguments.length, _ = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
                    _[_key2] = arguments[_key2];
                }

                return _this.on.apply(_this, _);
            })) {
                return this;
            } // simplify typing; eH = eventHandlers
            var eH = this[_eventHandlers];

            if (!eH.has(evt)) {
                // if we don't have an event category already in the map, create it as a new map
                // this map will be of the form bindingObject:methods.
                eH.set(evt, new core.Map());
            }

            // simplify typing; objMap == objectMap (bindingObject:methods)
            var objMap = eH.get(evt);

            if (!objMap.has(thisArg)) {
                // if we don't have `thisArg` in the map, make a set for it. The set is the set of functions
                // and we use a set so as to prevent duplicates automatically.
                objMap.set(thisArg, new core.Set());
            }
            var handlerSet = objMap.get(thisArg);

            if (typeof handler === "function") {
                // add the handler
                handlerSet.add(handler);
            } else {
                // a little error checking!
                throw new TypeError("Event handler must be a function.");
            }

            return this;
        }
677399
function dispatchEvent (event, data) {
    if (hasDOM()) {
      eventEmitter.dispatchEvent(new CustomEvent(event, data));
    } else if (hasEventEmitter()) {
      eventEmitter.emit(event, data);
    }
  }
781917
function on(emitter, eventName, handler, context) {
  handler = context ? handler.bind(context) : handler;
  emitter.addEventListener(eventName, handler);
  return handler;
}
724908
function PostEmitter() {
	var _this = this;
	//might be global
	this._listener = function(ev) {
		//check origin
		//then
		var data = ev.data;
		_this.emit.apply(_this, data instanceof Array ? data : [data]);
	};
	window[attach](prefix + 'message', this._listener);
}
759998
function () {
            /*  determine parameters  */
            var params = $cs.params("call", arguments, {
                name:      { pos: 0,     req: true   },
                args:      { pos: "...", def: []     },
                capturing: {             def: false  },
                spreading: {             def: false  },
                bubbling:  {             def: true   }
            });

            /*  dispatch service event onto target component  */
            var ev = this.publish({
                name:         "ComponentJS:service:" + params.name,
                args:         params.args,
                capturing:    params.capturing,
                spreading:    params.spreading,
                bubbling:     params.bubbling,
                firstonly:    true,
                async:        false
            });

            /*  ensure that the service event was successfully dispatched
                at least once (or our result value would have no meaning)  */
            if (!ev.dispatched())
                throw _cs.exception("call", "no such registered service found:" +
                    " \"" + params.name + "\"");

            /*  return the result value  */
            return ev.result();
        }
1229550
def on(self, name, _callback=None):
        

        # this is being used as a decorator
        if _callback is None:
            return lambda cb: self.on(name, cb)

        if not (callable(_callback) or isawaitable(_callback)):
            msg = "Callback not callable: {0!r}".format(_callback)
            raise ValueError(msg)

        self._event_list[name].append(_callback)
        return _callback
190038
function on(event, fn) {
		if (typeof event !== 'string') {
			throw new Error('"event" not a string');
		}
		if (!(fn instanceof Function)) {
			throw new Error('"fn" not a Function');
		}

		if (hasListener(event, fn)) {
			return false;
		}

		if (!hasListeners(event)) {
			listeners[event] = [];
		}
		listeners[event].push(fn);

		return true;
	}
305211
function( definition ) {
				var regex = /^on([A-Z]\w+)/,
					match;

				var registerDomEvent = function( uiElement, dialog, eventName, func ) {
						uiElement.on( 'formLoaded', function() {
							uiElement.getInputElement().on( eventName, func, uiElement );
						} );
					};

				for ( var i in definition ) {
					if ( !( match = i.match( regex ) ) )
						continue;

					if ( this.eventProcessors[ i ] )
						this.eventProcessors[ i ].call( this, this._.dialog, definition[ i ] );
					else
						registerDomEvent( this, this._.dialog, match[ 1 ].toLowerCase(), definition[ i ] );
				}

				return this;
			}
306369
function (def, debug) {
  this.id = Consumer.nextId();
  util.handleEvents(this);
  this.debug = debug;

  this.definition = def;
  this.mode = Provider.mode.synchronous;
  this.channels = {};
  this.iface = null;
  this.closeHandlers = {};
  this.providerCls = null;

  this.ifaces = {};
  this.emits = {};
}
440768
@Reference(service = EventEngine.class,
               cardinality = ReferenceCardinality.MANDATORY)
    protected void setEventService(EventEngine service) {
        this.eventService = service;
    }
696677
function on(eventNamesOrPatterns, handler) {
    if (!eventNamesOrPatterns) {
      throw new Error('Must pass at least one event name or matching RegEx');
    }
    assert.func(handler, 'handler');
    if (!Array.isArray(eventNamesOrPatterns)) {
      eventNamesOrPatterns = [eventNamesOrPatterns];
    }
    for (let i = 0; i < eventNamesOrPatterns.length; i++) {
      buckets.push({
        pattern: ensureRegExp(eventNamesOrPatterns[i]),
        handler: handler
      });
    }
  }
1209544
def on(  # pylint: disable=invalid-name
            self, event: str, *handlers: T.Callable
    ) -> T.Callable:
        """"""

        def _on_wrapper(*handlers: T.Callable) -> T.Callable:
            """wrapper for on decorator"""
            self._events[event].extend(handlers)
            return handlers[0]

        if handlers:
            return _on_wrapper(*handlers)
        return _on_wrapper
146897
function on (el, event, handler) {
  if (el.addEventListener) {
    el.addEventListener(event, handler)
  } else {
    el.attachEvent('on' + event, function () {
      handler.call(el)
    })
  }
}
1235240
function ($element, event, fn) {
		var handler = {
			$element: $element,
			event: event,
			fn: fn
		};
		existingHandlers.push(handler);
		return $element.on(event, fn);
	}
555381
function then(onFulfilled, onRejected) {
      var state = getInternalPromiseState(this);
      var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
      reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
      reaction.fail = typeof onRejected == 'function' && onRejected;
      reaction.domain = IS_NODE ? process.domain : undefined;
      state.parent = true;
      state.reactions.push(reaction);
      if (state.state != PENDING) notify(this, state, false);
      return reaction.promise;
    }