2015-02-15 17:33:06 -07:00
|
|
|
|
(function (globalScope) {
|
|
|
|
|
|
|
|
|
|
globalScope.Events = {
|
|
|
|
|
|
2015-03-05 20:22:43 -07:00
|
|
|
|
on: function (obj, eventName, selector, fn) {
|
2015-02-15 17:33:06 -07:00
|
|
|
|
|
|
|
|
|
Logger.log('event.on ' + eventName);
|
2015-03-05 20:22:43 -07:00
|
|
|
|
jQuery(obj).on(eventName, selector, fn);
|
2015-02-15 17:33:06 -07:00
|
|
|
|
},
|
|
|
|
|
|
2015-03-05 20:22:43 -07:00
|
|
|
|
off: function (obj, eventName, selector, fn) {
|
2015-02-15 17:33:06 -07:00
|
|
|
|
|
|
|
|
|
Logger.log('event.off ' + eventName);
|
2015-03-05 20:22:43 -07:00
|
|
|
|
jQuery(obj).off(eventName, selector, fn);
|
2015-02-15 17:33:06 -07:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
trigger: function (obj, eventName, params) {
|
|
|
|
|
Logger.log('event.trigger ' + eventName);
|
2015-02-16 09:47:30 -07:00
|
|
|
|
jQuery(obj).trigger(eventName, params);
|
2015-02-15 17:33:06 -07:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2015-06-29 19:52:23 -07:00
|
|
|
|
})(window);
|
|
|
|
|
|
|
|
|
|
//(function () {
|
|
|
|
|
|
|
|
|
|
// function useJqueryEvents(elems, eventName) {
|
|
|
|
|
|
|
|
|
|
// eventName = eventName.type || eventName;
|
|
|
|
|
|
|
|
|
|
// if (typeof eventName == 'string') {
|
|
|
|
|
// if (eventName.indexOf('page') == 0) {
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
// if (eventName.indexOf('loadercreate') == 0) {
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// //console.log('bean: ' + eventName);
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// $.fn.jTrigger = $.fn.trigger;
|
|
|
|
|
// $.fn.jOn = $.fn.on;
|
|
|
|
|
// $.fn.jOff = $.fn.off;
|
|
|
|
|
|
|
|
|
|
// $.fn.off = function (eventName, selector, fn, ex1, ex2, ex3) {
|
|
|
|
|
|
|
|
|
|
// if (arguments.length > 3 || useJqueryEvents(this, eventName)) {
|
|
|
|
|
// this.jOff(eventName, selector, fn, ex1, ex2, ex3);
|
|
|
|
|
// return this;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// for (var i = 0, length = this.length; i < length; i++) {
|
|
|
|
|
// bean.off(this[i], eventName, selector, fn);
|
|
|
|
|
// }
|
|
|
|
|
// return this;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// $.fn.on = function (eventName, selector, fn, ex1, ex2, ex3) {
|
|
|
|
|
|
|
|
|
|
// if (arguments.length > 3 || useJqueryEvents(this, eventName)) {
|
|
|
|
|
// this.jOn(eventName, selector, fn, ex1, ex2, ex3);
|
|
|
|
|
// return this;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// for (var i = 0, length = this.length; i < length; i++) {
|
|
|
|
|
// bean.on(this[i], eventName, selector, fn);
|
|
|
|
|
// }
|
|
|
|
|
// return this;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// $.fn.trigger = function (eventName, params) {
|
|
|
|
|
|
|
|
|
|
// if (useJqueryEvents(this, eventName)) {
|
|
|
|
|
// this.jTrigger(eventName, params);
|
|
|
|
|
// return this;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// var i, length;
|
|
|
|
|
|
|
|
|
|
// // Need to push an extra param to make the argument order consistent with jquery
|
|
|
|
|
// var newParams = [];
|
|
|
|
|
// newParams.push({});
|
|
|
|
|
|
|
|
|
|
// if (params && params.length) {
|
|
|
|
|
// for (i = 0, length = params.length; i < length; i++) {
|
|
|
|
|
// newParams.push(params[i]);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// for (i = 0, length = this.length; i < length; i++) {
|
|
|
|
|
// bean.fire(this[i], eventName, newParams);
|
|
|
|
|
// }
|
|
|
|
|
// return this;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
//})();
|