Skip to content

Instantly share code, notes, and snippets.

@miya2000
Created April 8, 2010 14:14
Show Gist options
  • Select an option

  • Save miya2000/360106 to your computer and use it in GitHub Desktop.

Select an option

Save miya2000/360106 to your computer and use it in GitHub Desktop.
javascript:(function(){
var f=function(){
var a=[];
function d(){
a.shift().apply(d,arguments);
}
d.add=function(f){
a.push(f);
return d;
};
return d;
}().add(function(i){
alert('a:'+i);
}).add(function(j){
alert('b:'+j);
});
f(100); // a:100
f(200); // b:200
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment