Skip to content

Instantly share code, notes, and snippets.

@cowboy
Last active March 23, 2023 15:22
Embed
What would you like to do?
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
};
$.unsubscribe = function() {
o.off.apply(o, arguments);
};
$.publish = function() {
o.trigger.apply(o, arguments);
};
}(jQuery));
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function(a){var b=a({});a.subscribe=function(){b.on.apply(b,arguments)},a.unsubscribe=function(){b.off.apply(b,arguments)},a.publish=function(){b.trigger.apply(b,arguments)}})(jQuery)
@AmoeScott
Copy link

I will try that code. Thank you. https://cincinnati-seo.com/

@andrewmcmason
Copy link

Can someone help please with a TypeScript version? I'm trying to implement it on nyt crossword answers

@leeannpor89
Copy link

The coding was complicated but thank you for sharing it with us. I would even share this with my friend working at Snow Removal Kamloops.

@joanadavidson
Copy link

I still receive notifications about this thread even when i'm in El Paso. Any update?

@SEO11SEO
Copy link

code is perfect i hope to see more kleinanzeigen

@michsullivan015
Copy link

I had a difficult time understanding the code. I'm having an headache. If interested, please visit our website.

@montans
Copy link

montans commented Mar 15, 2023

It allows different aspects of your application, usually called modules, to both subscribe to events other modules might publish, & publish ...
balenaetcher website & krnl download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment