var store = {
nextId: 1,
cache: {},
add: function(fn) {
if (!fn.id) {
fn.id = this.nextId++;
this.cache[fn.id] = fn;
return true;
}
}
}
// usage
// function ninja(){}
// store.add(ninja);
Last active
April 8, 2018 21:47
-
-
Save binario200/693e21fd0004a1ce6374a6e2ef97731c to your computer and use it in GitHub Desktop.
Storing a collection of unique functions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment