Skip to content

Instantly share code, notes, and snippets.

@americodls
Last active September 22, 2015 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save americodls/9696833 to your computer and use it in GitHub Desktop.
Save americodls/9696833 to your computer and use it in GitHub Desktop.
Pub/Sub pattern using only jQuery.
window.mediator = $({});
$(function() {
mediator.on("foo:bar", fooBar);
mediator.trigger("foo:bar");
});
function fooBar(event) {
alert("Foo Bar");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment