lib/index.js
function emitSyncFlag(evt, args) {
            var _this3 = this;

            var async = arguments[2] === undefined ? true : arguments[2];

            var sender = this,
                eH = this[_eventHandlers];

            // emit locally first to onEvent handlers
            try {
                (function () {
                    var onEvent = "on:" + evt,
                        sanitizedEvent = evt.replace(/\:/g, "_"),
                        onSanitizedEvent = "on" + sanitizedEvent,
                        ProperEventCase = sanitizedEvent[0].toUpperCase() + sanitizedEvent.substr(1),
                        onProperEventCase = "on" + ProperEventCase,
                        localHandler = undefined;

                    if (_this3[onEvent]) {
                        localHandler = _this3[onEvent];
                    } else if (_this3[onSanitizedEvent]) {
                        localHandler = _this3[onSanitizedEvent];
                    } else if (_this3[onProperEventCase]) {
                        localHandler = _this3[onProperEventCase];
                    }
                    if (localHandler) {
                        if (async) {
                            setImmediate(function () {
                                tryWrapper.apply(undefined, [localHandler.bind(sender), sender, evt].concat(_toConsumableArray(args)));
                            });
                        } else {
                            tryWrapper.apply(undefined, [localHandler.bind(sender), sender, evt].concat(_toConsumableArray(args)));
                        }
                    }
                })();
            } catch (err) {
                console.log("EMITTER WARNING: Something broke while trying to call local methods.", err);
            }

            core.Array.from(eH)
            // for all the registered event categories, filter out the events that we really care about
            .filter(function (_ref3) {
                var _ref32 = _slicedToArray(_ref3, 1);

                var potentialEvent = _ref32[0];

                if (potentialEvent[0] !== "/") {
                    // the event isn't a regexp -- do a direct string compare
                    return potentialEvent === evt;
                } else {
                    // the event IS a regexp. Split on /, which returns an array of [ don't-care, expression, flags ]

                    var _potentialEvent$split = potentialEvent.split("/");

                    var _potentialEvent$split2 = _slicedToArray(_potentialEvent$split, 3);

                    var exp = _potentialEvent$split2[1];
                    var flags = _potentialEvent$split2[2];

                    // Return the result of the new regular expression.
                    // TODO: I suppose we should think about caching the regular expression objects for performance.
                    return new RegExp(exp, flags).test(evt);
                }
            })
            // and now we want to call each handler
            .forEach(function (_ref4) {
                var _ref42 = _slicedToArray(_ref4, 2);

                var objMap = _ref42[1];

                objMap.forEach(function (handlerSet, thisArg) {
                    if (handlerSet !== undefined) {
                        handlerSet.forEach(function (handler) {
                            if (async) {
                                setImmediate(function () {
                                    tryWrapper.apply(undefined, [handler.bind(thisArg), sender, evt].concat(_toConsumableArray(args)));
                                });
                            } else {
                                tryWrapper.apply(undefined, [handler.bind(thisArg), sender, evt].concat(_toConsumableArray(args)));
                            }
                        });
                    }
                });
            });
        }
function emitSyncFlag(evt, args) {
            var _this3 = this;

            var async = arguments[2] === undefined ? true : arguments[2];

            var sender = this,
                eH = this[_eventHandlers];

            // emit locally first to onEvent handlers
            try {
                (function () {
                    var onEvent = "on:" + evt,
                        sanitizedEvent = evt.replace(/\:/g, "_"),
                        onSanitizedEvent = "on" + sanitizedEvent,
                        ProperEventCase = sanitizedEvent[0].toUpperCase() + sanitizedEvent.substr(1),
                        onProperEventCase = "on" + ProperEventCase,
                        localHandler = undefined;

                    if (_this3[onEvent]) {
                        localHandler = _this3[onEvent];
                    } else if (_this3[onSanitizedEvent]) {
                        localHandler = _this3[onSanitizedEvent];
                    } else if (_this3[onProperEventCase]) {
                        localHandler = _this3[onProperEventCase];
                    }
                    if (localHandler) {
                        if (async) {
                            setImmediate(function () {
                                tryWrapper.apply(undefined, [localHandler.bind(sender), sender, evt].concat(_toConsumableArray(args)));
                            });
                        } else {
                            tryWrapper.apply(undefined, [localHandler.bind(sender), sender, evt].concat(_toConsumableArray(args)));
                        }
                    }
                })();
            } catch (err) {
                console.log("EMITTER WARNING: Something broke while trying to call local methods.", err);
            }

            core.Array.from(eH)
            // for all the registered event categories, filter out the events that we really care about
            .filter(function (_ref3) {
                var _ref32 = _slicedToArray(_ref3, 1);

                var potentialEvent = _ref32[0];

                if (potentialEvent[0] !== "/") {
                    // the event isn't a regexp -- do a direct string compare
                    return potentialEvent === evt;
                } else {
                    // the event IS a regexp. Split on /, which returns an array of [ don't-care, expression, flags ]

                    var _potentialEvent$split = potentialEvent.split("/");

                    var _potentialEvent$split2 = _slicedToArray(_potentialEvent$split, 3);

                    var exp = _potentialEvent$split2[1];
                    var flags = _potentialEvent$split2[2];

                    // Return the result of the new regular expression.
                    // TODO: I suppose we should think about caching the regular expression objects for performance.
                    return new RegExp(exp, flags).test(evt);
                }
            })
            // and now we want to call each handler
            .forEach(function (_ref4) {
                var _ref42 = _slicedToArray(_ref4, 2);

                var objMap = _ref42[1];

                objMap.forEach(function (handlerSet, thisArg) {
                    if (handlerSet !== undefined) {
                        handlerSet.forEach(function (handler) {
                            if (async) {
                                setImmediate(function () {
                                    tryWrapper.apply(undefined, [handler.bind(thisArg), sender, evt].concat(_toConsumableArray(args)));
                                });
                            } else {
                                tryWrapper.apply(undefined, [handler.bind(thisArg), sender, evt].concat(_toConsumableArray(args)));
                            }
                        });
                    }
                });
            });
        }
function emitSyncFlag ( evt , args ) { var _this3 = this ; var async = arguments [ 2 ] === undefined ? true : arguments [ 2 ] ; var sender = this , eH = this [ _eventHandlers ] ; // emit locally first to onEvent handlers try { ( function ( ) { var onEvent = "on:" + evt , sanitizedEvent = evt . replace ( / \: / g , "_" ) , onSanitizedEvent = "on" + sanitizedEvent , ProperEventCase = sanitizedEvent [ 0 ] . toUpperCase ( ) + sanitizedEvent . substr ( 1 ) , onProperEventCase = "on" + ProperEventCase , localHandler = undefined ; if ( _this3 [ onEvent ] ) { localHandler = _this3 [ onEvent ] ; } else if ( _this3 [ onSanitizedEvent ] ) { localHandler = _this3 [ onSanitizedEvent ] ; } else if ( _this3 [ onProperEventCase ] ) { localHandler = _this3 [ onProperEventCase ] ; } if ( localHandler ) { if ( async ) { setImmediate ( function ( ) { tryWrapper . apply ( undefined , [ localHandler . bind ( sender ) , sender , evt ] . concat ( _toConsumableArray ( args ) ) ) ; } ) ; } else { tryWrapper . apply ( undefined , [ localHandler . bind ( sender ) , sender , evt ] . concat ( _toConsumableArray ( args ) ) ) ; } } } ) ( ) ; } catch ( err ) { console . log ( "EMITTER WARNING: Something broke while trying to call local methods." , err ) ; } core . Array . from ( eH ) // for all the registered event categories, filter out the events that we really care about . filter ( function ( _ref3 ) { var _ref32 = _slicedToArray ( _ref3 , 1 ) ; var potentialEvent = _ref32 [ 0 ] ; if ( potentialEvent [ 0 ] !== "/" ) { // the event isn't a regexp -- do a direct string compare return potentialEvent === evt ; } else { // the event IS a regexp. Split on /, which returns an array of [ don't-care, expression, flags ] var _potentialEvent$split = potentialEvent . split ( "/" ) ; var _potentialEvent$split2 = _slicedToArray ( _potentialEvent$split , 3 ) ; var exp = _potentialEvent$split2 [ 1 ] ; var flags = _potentialEvent$split2 [ 2 ] ; // Return the result of the new regular expression. // TODO: I suppose we should think about caching the regular expression objects for performance. return new RegExp ( exp , flags ) . test ( evt ) ; } } ) // and now we want to call each handler . forEach ( function ( _ref4 ) { var _ref42 = _slicedToArray ( _ref4 , 2 ) ; var objMap = _ref42 [ 1 ] ; objMap . forEach ( function ( handlerSet , thisArg ) { if ( handlerSet !== undefined ) { handlerSet . forEach ( function ( handler ) { if ( async ) { setImmediate ( function ( ) { tryWrapper . apply ( undefined , [ handler . bind ( thisArg ) , sender , evt ] . concat ( _toConsumableArray ( args ) ) ) ; } ) ; } else { tryWrapper . apply ( undefined , [ handler . bind ( thisArg ) , sender , evt ] . concat ( _toConsumableArray ( args ) ) ) ; } } ) ; } } ) ; } ) ; }
Emit an event, specifying whether or not the event is synchronous or async.

@param {string} evt
@param {Array<*>} args
@param {boolean} [async]
Emit an event specifying whether or not the event is synchronous or async .