Add jquery.eventemitter
This commit is contained in:
parent
762ba21c7d
commit
c6e57c0051
1
main.js
1
main.js
@ -26,6 +26,7 @@ require.config({
|
||||
"crypto.mode-ctr": "components/otr/vendor/cryptojs/mode-ctr",
|
||||
"crypto": "src/crypto",
|
||||
"eventemitter": "components/otr/build/dep/eventemitter",
|
||||
"jquery.eventemitter": "src/jquery.eventemitter",
|
||||
"otr": "components/otr/build/otr",
|
||||
"converse-dependencies": "src/deps-full"
|
||||
},
|
||||
|
@ -2,6 +2,7 @@ define("converse-dependencies", [
|
||||
"otr",
|
||||
"locales",
|
||||
"backbone.localStorage",
|
||||
"jquery.eventemitter",
|
||||
"jquery.tinysort",
|
||||
"strophe",
|
||||
"strophe.muc",
|
||||
|
27
src/jquery.eventemitter.js
Normal file
27
src/jquery.eventemitter.js
Normal 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);
|
||||
}
|
||||
};
|
||||
}));
|
Loading…
Reference in New Issue
Block a user