if(typeof tree != "undefined"){ var node; if(index == path.length) { node = tree; }else{ this._publish(tree.c[path[index]], path, index + 1, name, msg); this._publish(tree.c["*"], path, index + 1, name, msg); node = tree.c["**"]; } if(typeof node != "undefined"){ var callbacks = node.s; var max = callbacks.length; for(var i = 0; i < max; i++){ if(callbacks[i].cb){ var sc = callbacks[i].scope; var cb = callbacks[i].cb; var fcb = callbacks[i].fcb; var d = callbacks[i].data; if(typeof cb == "string"){ // get a function object cb = sc[cb]; } if(typeof fcb == "string"){ // get a function object fcb = sc[fcb]; } if((!fcb) || (fcb.call(sc, name, msg, d))) { cb.call(sc, name, msg, d); } } } } }