function (method, handler) {
            if (!method || !handler) {
                return;
            }
            if (!this.handlers[method]) {
                //initialize array
                this.handlers[method] = [];
            }
            // add handler to the stack
            this.handlers[method].push(handler);
        }
function (method, handler) {
            if (!method || !handler) {
                return;
            }
            if (!this.handlers[method]) {
                //initialize array
                this.handlers[method] = [];
            }
            // add handler to the stack
            this.handlers[method].push(handler);
        }
function ( method , handler ) { if ( ! method || ! handler ) { return ; } if ( ! this . handlers [ method ] ) { //initialize array this . handlers [ method ] = [ ] ; } // add handler to the stack this . handlers [ method ] . push ( handler ) ; }
Subscribe handlers to specific messages.
@param {string} method Message type.
@param {function} handler.
TODO: add handler name or any identification mechanism to then implement 'off'?
Subscribe handlers to specific messages .
add handler to the stack