Skip to content

Instantly share code, notes, and snippets.

View alchaplinsky's full-sized avatar

Alex Chaplinsky alchaplinsky

View GitHub Profile
@alchaplinsky
alchaplinsky / example.js
Created July 24, 2012 12:11 — forked from addyosmani/example.js
Mediator pattern
// Example 1
mediator.name = 'Doug';
mediator.subscribe('nameChange', function(arg){
console.log(this.name);
this.name = arg;
console.log(this.name);
});
mediator.publish('nameChange', 'Jorn');