Update happen

This commit is contained in:
Tom MacWright
2012-11-26 17:40:46 -05:00
parent f1f1d108a0
commit 224420883a
+16 -2
View File
@@ -1,4 +1,4 @@
!(function(context) {
!(function(context, $) {
var h = {};
// Make inheritance bearable: clone one level of properties
@@ -85,7 +85,21 @@
this.happen = h;
// Export for nodejs
if (typeof module !== 'undefined') {
module.exports = this.happen;
}
})(this);
// Provide jQuery plugin
if ($ && $.fn) {
$.fn.happen = function(o) {
if (typeof o === 'string') {
o = { type: o };
}
for (var i = 0; i < this.length; i++) {
happen.once(this[i], o);
}
return this;
};
}
})(this, (typeof jQuery !== 'undefined') ? jQuery : null);