text: // Source: https://github.com/jrf0110/backbone-events
  (function(){
  	var EventDispatcher = {
  		on: function(events, callback, context) {
  			var ev;
  			events = events.split(/\s+/);
  			var calls = this._callbacks || (this._callbacks = {});
  			while (ev = events.shift()) {
  				var list  = calls[ev] || (calls[ev] = {});
  				var tail = list.tail || (list.tail = list.next = {});
  				tail.callback = callback;
  				tail.context = context;
  				list.tail = tail.next = {};
  			}
  			return this;
  		},
  		off: function(events, callback, context) {
  			var ev, calls, node;
  			if (!events) {
  				delete this._callbacks;
  			} else if (calls = this._callbacks) {
  				events = events.split(/\s+/);
  				while (ev = events.shift()) {
  					node = calls[ev];
  					delete calls[ev];
  					if (!callback || !node) continue;
  					// Create a new list, omitting the indicated event/context pairs.
  					while ((node = node.next) && node.next) {
  						if (node.callback === callback &&
  							(!context || node.context === context)) continue;
  						this.on(ev, node.callback, node.context);
  					}
  				}
  			}
  			return this;
  		},
  		trigger: function(events) {
  			var event, node, calls, tail, args, all, rest;
  			if (!(calls = this._callbacks)) return this;
  			all = calls['all'];
  			(events = events.split(/\s+/)).push(null);
  			// Save references to the current heads & tails.
  			while (event = events.shift()) {
  				if (all) events.push({next: all.next, tail: all.tail, event: event});
  				if (!(node = calls[event])) continue;
  				events.push({next: node.next, tail: node.tail});
  			}
  			// Traverse each list, stopping when the saved tail is reached.
  			rest = Array.prototype.slice.call(arguments, 1);
  			while (node = events.pop()) {
  				tail = node.tail;
  				args = node.event ? [node.event].concat(rest) : rest;
  				while ((node = node.next) !== tail) {
  					node.callback.apply(node.context || this, args);
  				}
  			}
  			return this;
  		}
  	};
  	if (typeof define == "function") define(function(){ return EventDispatcher; });
  	else if (typeof module == "object") module.exports = EventDispatcher;
  	else window.EventDispatcher = EventDispatcher;
  })();