Created
March 12, 2012 16:02
-
-
Save jCrip/2022986 to your computer and use it in GitHub Desktop.
jQuery: pub/sub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PubSub | |
(function( $ ) { | |
var o = $( {} ); | |
$.each({ | |
trigger: 'publish', | |
on: 'subscribe', | |
off: 'unsubscribe' | |
}, function( key, val ) { | |
jQuery[val] = function() { | |
o[key].apply( o, arguments ); | |
}; | |
}); | |
})( jQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment