Skip to content

Instantly share code, notes, and snippets.

@zeekay
Created April 5, 2012 00:50
Show Gist options
  • Save zeekay/2306967 to your computer and use it in GitHub Desktop.
Save zeekay/2306967 to your computer and use it in GitHub Desktop.
function fn1() {}
function fn2() {}
function fn3() {}
function jsListener(fn) {
var interface = {
fn1: fn1,
fn2: fn2,
fn3: fn3
}
var f = interface[fn];
if (f) {
var args = [].slice.call(arguments, 1);
return f.apply(this, args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment