xmpp.chapril.org-conversejs/src/jquery.eventemitter.js

26 lines
643 B
JavaScript
Raw Normal View History

2015-10-25 18:49:35 +01:00
/*global $ */
2013-12-15 14:51:12 +01:00
(function (root, factory) {
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);
}
};
}));