Created
November 11, 2013 00:40
-
-
Save eschie/7405986 to your computer and use it in GitHub Desktop.
My First Pub/Sub
This file contains hidden or 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
/* MY FIRST PUB/SUB jQuery | |
* ESCHIE/DESIGN_PATTERNS | |
* | |
*/ | |
(function($) { | |
var o = $( {} ); | |
$.each({ | |
trigger: 'publish', | |
on: 'subscribe', | |
off: 'unsubscribe' | |
}, function( fn, api ){ | |
jQuery[api] = function() { | |
o[fn].apply( o, arguments ); | |
}; | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment