Skip to content

Instantly share code, notes, and snippets.

@cowboy
Last active March 29, 2023 10:54
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)
@andrewmcmason
Copy link

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

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

@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.

@parasthackral
Copy link

In just three easy steps, Balena Etcher promises to burn operating system images to SD cards and portable ffh4x apk media flawlessly.

@parasthackral
Copy link

The Aurora store was initially based on Sergei Yeriomin's Yalp store, but v3.0 krnl apk has been completely rewritten to run on all Android 5.0 devices following Material Design Rewritten.

@parasthackral
Copy link

A free Android app called PGSharp apk and aniyomi apk lets you change where your Pokémon GO GPS is. This software lets you control how your Avatar moves without actually moving.

@rickluck90
Copy link

Cool! I'll surely be coming back for the next posts from you. Rick from Residential Painters in Regina

@gringoxpcom
Copy link

Thanks for sharing this amazing post synapse x website and also btroblox website.

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