lib/event.js
function streamOn(name, fn) {
        var str,
            handle;
        if (typeof name === 'string') {
            str = name;
            name = {
                test: function (val) {
                    return val === str;
                }
            };
        }
        /**
         * @callback {EventStream.handle}
         * @param chunk
         * @type {function}
         */
        handle = function (chunk) {
            if (name.test(chunk.name)) {
                fn(chunk.data);
            }
        };
        this.eventStreamListeners.push(handle);
        return handle;
    }
function streamOn(name, fn) {
        var str,
            handle;
        if (typeof name === 'string') {
            str = name;
            name = {
                test: function (val) {
                    return val === str;
                }
            };
        }
        /**
         * @callback {EventStream.handle}
         * @param chunk
         * @type {function}
         */
        handle = function (chunk) {
            if (name.test(chunk.name)) {
                fn(chunk.data);
            }
        };
        this.eventStreamListeners.push(handle);
        return handle;
    }
function streamOn ( name , fn ) { var str , handle ; if ( typeof name === 'string' ) { str = name ; name = { test : function ( val ) { return val === str ; } } ; } /**
         * @callback {EventStream.handle}
         * @param chunk
         * @type {function}
         */ handle = function ( chunk ) { if ( name . test ( chunk . name ) ) { fn ( chunk . data ) ; } } ; this . eventStreamListeners . push ( handle ) ; return handle ; }
Receive an event from a stream
@param {string|RegExp|{test:function}} name - Name of the events that should be listened
@param {function} fn - Function to execute when receiving event
@returns {EventStream.handle}
Receive an event from a stream