Skip to content

Instantly share code, notes, and snippets.

@zz85
Created June 22, 2012 21:01
Show Gist options
  • Save zz85/2975176 to your computer and use it in GitHub Desktop.
Save zz85/2975176 to your computer and use it in GitHub Desktop.
Example for SimpleEvent component from http://jsdo.it/zz85/75cq
// generates a "event channel"
var onFire = new SimpleEvent();
// adds an listener
onFire.add(function aListener(hello, world){
alert(hello + ' ' + world);
})
// notifies listeners
onFire.notify('Bye', 'Universe');
// unregister listener
onFire.remove(aListener);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment