lost+found/src/events.js
function _gpfEventsFire (event, params, eventsHandler) {
    /*jshint validthis:true*/ // will be invoked with apply
    _gpfAssert(_gpfEventsIsValidHandler(eventsHandler), "Expected a valid event handler");
    if (!(event instanceof _GpfEvent)) {
        event = new gpf.events.Event(event, params, this);
    }
    return new Promise(function (resolve/*, reject*/) {
        // This is used both to limit the number of recursion and increase the efficiency of the algorithm.
        if (++_gpfEventsFiring > 10) {
            // Too much recursion, use setTimeout to free some space on the stack
            setTimeout(_gpfEventsTriggerHandler.bind(null, event, eventsHandler, resolve), 0);
        } else {
            _gpfEventsTriggerHandler(event, eventsHandler);
            resolve(event);
        }
        --_gpfEventsFiring;
    });
}
function _gpfEventsFire (event, params, eventsHandler) {
    /*jshint validthis:true*/ // will be invoked with apply
    _gpfAssert(_gpfEventsIsValidHandler(eventsHandler), "Expected a valid event handler");
    if (!(event instanceof _GpfEvent)) {
        event = new gpf.events.Event(event, params, this);
    }
    return new Promise(function (resolve/*, reject*/) {
        // This is used both to limit the number of recursion and increase the efficiency of the algorithm.
        if (++_gpfEventsFiring > 10) {
            // Too much recursion, use setTimeout to free some space on the stack
            setTimeout(_gpfEventsTriggerHandler.bind(null, event, eventsHandler, resolve), 0);
        } else {
            _gpfEventsTriggerHandler(event, eventsHandler);
            resolve(event);
        }
        --_gpfEventsFiring;
    });
}
function _gpfEventsFire ( event , params , eventsHandler ) { /*jshint validthis:true*/ // will be invoked with apply _gpfAssert ( _gpfEventsIsValidHandler ( eventsHandler ) , "Expected a valid event handler" ) ; if ( ! ( event instanceof _GpfEvent ) ) { event = new gpf . events . Event ( event , params , this ) ; } return new Promise ( function ( resolve /*, reject*/ ) { // This is used both to limit the number of recursion and increase the efficiency of the algorithm. if ( ++ _gpfEventsFiring > 10 ) { // Too much recursion, use setTimeout to free some space on the stack setTimeout ( _gpfEventsTriggerHandler . bind ( null , event , eventsHandler , resolve ) , 0 ) ; } else { _gpfEventsTriggerHandler ( event , eventsHandler ) ; resolve ( event ) ; } -- _gpfEventsFiring ; } ) ; }
gpf.events.fire implementation

@param {String/gpf.events.Event} event event name or event object to fire
@param {Object} params dictionary of parameters for the event object
creation, they are ignored if an event object is specified
@param {gpf.events.Handler} eventsHandler
@return {Promise<gpf.events.Event>} fulfilled when the event has been fired
gpf . events . fire implementation