Skip to content

Instantly share code, notes, and snippets.

@americodls
Last active September 22, 2015 21:24
Show Gist options
  • 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