Skip to content

Instantly share code, notes, and snippets.

View mszynka's full-sized avatar

Mateusz Szynka mszynka

View GitHub Profile
@mszynka
mszynka / mediator.js
Last active September 21, 2015 19:27 — forked from piotrlewandowski/mediator.js
JS Mediator Pattern Implementation
var mediator = (function() {
'use strict';
var
subscribe = function(channel, fn) {
if (!mediator.channels[channel]) {
mediator.channels[channel] = [];
}
mediator.channels[channel].push({ context: this, callback: fn });