Skip to content

Instantly share code, notes, and snippets.

@Qard
Created April 1, 2012 13:39
Show Gist options
  • Save Qard/2275363 to your computer and use it in GitHub Desktop.
Save Qard/2275363 to your computer and use it in GitHub Desktop.
Micro event dispatcher
function ev (m,e) {
m = this, e = []
m.on = function (a, b) { e.push([a,b]) }
m.emit = function (a) {
for (var i in e) e[i][0].test(a) && e[i][1].apply(m, [].slice.call(arguments, 1))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment