Snippet for implementation of publish/subscribe pattern.
This snippet is especially useful when working with self-implemented MVC patterns and it was originaly created for that reason.
The usage of the snippet is rather fairly easy and doesn't need a lot of explanation.
var someEvent = new Subject();
someEvent.subscribe(subscriber);
someEvent.publish();
someEvent.unbscribe(subscriber);