Add jquery.eventemitter

This commit is contained in:
JC Brand 2013-12-15 15:51:12 +02:00
parent 762ba21c7d
commit c6e57c0051
3 changed files with 29 additions and 0 deletions

View File

@ -26,6 +26,7 @@ require.config({
"crypto.mode-ctr": "components/otr/vendor/cryptojs/mode-ctr", "crypto.mode-ctr": "components/otr/vendor/cryptojs/mode-ctr",
"crypto": "src/crypto", "crypto": "src/crypto",
"eventemitter": "components/otr/build/dep/eventemitter", "eventemitter": "components/otr/build/dep/eventemitter",
"jquery.eventemitter": "src/jquery.eventemitter",
"otr": "components/otr/build/otr", "otr": "components/otr/build/otr",
"converse-dependencies": "src/deps-full" "converse-dependencies": "src/deps-full"
}, },

View File

@ -2,6 +2,7 @@ define("converse-dependencies", [
"otr", "otr",
"locales", "locales",
"backbone.localStorage", "backbone.localStorage",
"jquery.eventemitter",
"jquery.tinysort", "jquery.tinysort",
"strophe", "strophe",
"strophe.muc", "strophe.muc",

View File

@ -0,0 +1,27 @@
(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);
}
};
}));