订阅广播事件
@param  {[type]}   types     事件类型，支持,分隔符
@param  {Function} callback 回调函数
@param  {[type]}   scope    回调函数上下文
@return {[type]}            this
507783
function(types, callback, scope){
            types = types || [];
            var args = [].slice.call(arguments);

            if($.isString(types)){
                types = types.split(',');
            }
            var len = types.length;
            if(len===0){
                return this;
            }
            args = args.length > 3 ? args.splice(3, args.length-1) : [];
            for(var i = 0;i<len;i++){
                var type = types[i];
                _cache[type] = _cache[type] || [];
                _cache[type].push({callback:callback,scope:scope,args:args});
            }
            return this;
        }
547647
function wrapCallback(resolver, promise, callback) {
        return function (data) {

            function work() {
                // 可能抛异常
                var res = callback(data);
                // 返回结果与当前的promise对象相同
                // 抛异常
                // see # 2.3.1
                if (res === promise) {
                    throw new TypeError();
                }

                resolve(resolver, res);
            }

            if (captureException) {
                try {
                    work();
                }
                catch (e) {
                    emitExceptionEvent(e);
                    resolver.reject(e);
                }
            }
            else {
                work();
            }

        };
    }
850619
function(type, data){
            var listeners = _cache[type],len = 0;
            if(!$.isUndefined(listeners)){
                var args = [].slice.call(arguments, 0);
                args = args.length > 2 ? args.splice(2, args.length-1) : [];
                args = [data].concat(args);

                len = listeners.length;
                for(var i = 0; i<len;i++){
                    var listener = listeners[i];
                    if(listener && listener.callback) {
                        args = args.concat(listener.args);
                        listener.callback.apply(listener.scope, args);
                    }
                }
            }
            return this;
        }
29887
function addEventListeners(target, types, handler) {
    each(splitStr(types), function(type) {
        target.addEventListener(type, handler, false);
    });
}
1088979
function bind( fn, scope ) {
    var bound, args;
    if ( fn.bind === nativeBind && nativeBind ) return nativeBind.apply( fn, Array.prototype.slice.call( arguments, 1 ) );
    args = Array.prototype.slice.call( arguments, 2 );
    // @todo: don't link this
    bound = function() {
        if ( !(this instanceof bound) ) return fn.apply( scope, args.concat( Array.prototype.slice.call( arguments ) ) );
        W.ctor.prototype = fn.prototype;
        var self = new ctor();
        var result = fn.apply( self, args.concat( Array.prototype.slice.call( arguments ) ) );
        if ( Object( result ) === result ) return result;
        return self;
    };
    return bound;
}
1044706
function all(type, callback) {
      if (!wm.get(callback)) {
        wm.set(callback, function fn() {
          invoke = false;
          when(type, fn);
          invoke = true;
          resolve(arguments).then(bind.call(broadcast, callback));
        });
        when(type, wm.get(callback));
      }
    }
1082326
public function addCallback( $type, $callback ) {
		if ( !isset( $this->callbacks[$type] ) ) {
			$this->callbacks[$type] = [];
		}
		$this->callbacks[$type][] = $callback;
	}
435903
def add_listener(type, once=false, &callback)
      listener = Listener.new(type, callback, once)
      listeners[type] ||= []
      listeners[type] << listener
      emit(:new_listener, self, type, once, callback)
      listener
    end
107734
function _attachListener(object, type, callback) {
  if (object.addEventListener) {
    object.addEventListener(type, callback, false);
  } else {
    object.attachEvent('on' + type, callback);
  }
}
351819
function(key, type, callback) {
		return function(value) {
			try {
				if ( value != null || type === 'string' ) {
					if (value) {
						localStorage.setItem(key, type === 'boolean' ? 'X' : value);
					} else {
						localStorage.removeItem(key);
					}
					callback(value);
				}
				value = localStorage.getItem(key);
				return type === 'boolean' ? value === 'X' : value;
			} catch (e) {
				Log.warning("Could not access localStorage while accessing '" + key + "' (value: '" + value + "', are cookies disabled?): " + e.message);
			}
		};
	}
913072
public void callCallbacks(Event event, CallbackType type) throws CancelledException, AsyncException {
		String trigger = event.name;
		if (type == CallbackType.LEAVE_STATE) trigger = event.src;
		else if (type == CallbackType.ENTER_STATE) trigger = event.dst;

		Callback[] callbacks = new Callback[] {
				this.callbacks.get(new CallbackKey(trigger, type)),	//Primary
				this.callbacks.get(new CallbackKey("", type)),			//General
		};

		for (Callback callback : callbacks) {
			if (callback != null) {
				callback.run(event);
				if (type == CallbackType.LEAVE_STATE) {
					if (event.cancelled) {
						transition = null;
						throw new CancelledException(event.error);
					} else if (event.async) {
						throw new AsyncException(event.error);
					}
				} else if (type == CallbackType.BEFORE_EVENT) {
					if (event.cancelled) {
						throw new CancelledException(event.error);
					}
				}
			}
		}
	}
206724
function (node, type, callback) {
      if (node.addEventListener) {
        node.addEventListener(type, function (e) {
          callback(e, e.target)
        }, false)
      } else if (node.attachEvent) {
        node.attachEvent('on' + type, function (e) {
          callback(e, e.srcElement)
        })
      }
    }
137305
function(type) {
            var name = type;
            this[type] = _.bind(function() {
                var args = Array.prototype.slice.call(arguments, 0);
                args.splice(0, 0, type);
                return this.printLog.apply(this, args);
            }, this);
            return this[type];
        }
378232
function(element, type, handler) {
    var types = type.split(' ');
    Hammer.utils.each(types, function(type){
      element.addEventListener(type, handler, false);
    });
  }
1198958
function (type, handler) {

            // Validate arguments
            if (typeof type !== 'string') {
                throw new Error('Type must be a string');
            }
            if (typeof handler !== 'function') {
                throw new Error('Handler must be a function');
            }

            // Check for presence of event store
            if (!this._events) {
                this._events = {};
            }
            if (!this._events[type]) {
                this._events[type] = [];
            }

            // Add handler
            this._events[type].push(handler);

        }
1266606
function(type, originalEvent) {
//		this.debug("_trigger(" + type + ")", ctx);
		var ctx = this._makeHookContext(this, originalEvent),
			res = this.widget._trigger(type, originalEvent, ctx);

		if(res !== false && ctx.result !== undefined){
			return ctx.result;
		}
		return res;
	}
200347
function(type) {
        var self = this,
            event,
            context,
            func,
            selector,
            win = $(window),
            doc = $(document);

        $.each(this.__events, function(i, value) {
            event = value[0];
            context = value[1];
            func = value[2];
            selector = value[3];

            // Determine the correct context
            if (self[context]) {
                context = self[context];

            } else if (context === 'window') {
                context = win;

            } else if (context === 'document') {
                context = doc;
            }

            // Ready events
            if (event === 'ready') {
                doc.ready(func);

            // Delegated events
            } else if (selector) {
                $(context)[type](event, selector, func);

            // Regular events
            } else {
                $(context)[type](event, func);
            }
        });
    }