Skip to content

Instantly share code, notes, and snippets.

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)
@lanikane
Copy link

lanikane commented Aug 16, 2022

Your article is very helpful for me. I am very impressed with your article. It gives me a lot of interesting information about quordle moviedle . Thank you very much.

@Rosendamans
Copy link

Rosendamans commented Aug 22, 2022

I suppose I should pose that issue on a Zepto forum, but I thought someone might have a workaround here. awnings near me Toms River NJ

@joanadavidson
Copy link

joanadavidson commented Sep 15, 2022

Zepto only makes use of the DOM-based event system so there's no way to get a real empty element to work as the global pub/sub-object. We might as well use ("").

Joana | peeling wallpaper

@biano22
Copy link

biano22 commented Sep 29, 2022

Thank you very much for your sharing, it has helped me in my great work, I have reduced my working time a lot because of you. I have coded some games like quordle , temple run .. if you are interested please connect with me.

@andrewmcmason
Copy link

andrewmcmason commented Nov 7, 2022

Very elegant and clean code! Good job Ben! I've been using it personally at both my fun projects over at Taylordle and also Quordle game

@andrewmcmason
Copy link

andrewmcmason commented Nov 7, 2022

I strongly believe that react is the way to go, especially when you are planning on having 1M+ visitors per day. A clear example is Wordle.gg which is a wordle game site and they are built using React

@bellid8
Copy link

bellid8 commented Dec 6, 2022

This is the code we've been looking for. Thanks for sharing this valuable information. Nice work!
Driveway Gates Victoria

@AmoeScott
Copy link

AmoeScott commented Dec 9, 2022

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

@andrewmcmason
Copy link

andrewmcmason commented Dec 9, 2022

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

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