xmpp.chapril.org-conversejs/src/jquery.eventemitter.js
2013-12-15 15:51:12 +02:00

28 lines
781 B
JavaScript

(function (root, factory) {
if (typeof console === "undefined" || typeof console.log === "undefined") {
console = { log: function () {}, error: function () {} };
}
if (typeof define === 'function' && define.amd) {
define("converse", ["jquery"], function($) {
return factory($);
});
} else {
factory($);
}
}(this, function ($) {
$.eventEmitter = {
emit: function(evt, data) {
$(this).trigger(evt, data);
},
once: function(evt, handler) {
$(this).one(evt, handler);
},
on: function(evt, handler) {
$(this).bind(evt, handler);
},
off: function(evt, handler) {
$(this).unbind(evt, handler);
}
};
}));