I normally do something like this:
new Chain().chain(
function(){ alert('get groceries'); this.callChain(); },
function(){ alert('go workout'); this.callChain(); },
function(){ alert('code mootools...'); this.callChain(); },
function(){ alert('sleep'); this.callChain(); }
).callChain();
http://jsfiddle.net/D5reU/
On 2012-04-21 12:02 PM, Arian Stolwijk wrote:
You could of course use .callChain()
https://tinker.io/4925f
On Sat, Apr 21, 2012 at 6:53 PM, Chris Jiang <jiang...@gmail.com
<mailto:jiang...@gmail.com>> wrote:
Hi guys, basically, I'm trying to implement an standalone chain
controller to my project, but the official sample code seems not
working, and I can't find why. How should I create a set of
functions to be executed one after each? @@"
var Todo =new Class({
Implements: Chain,
initialize:function(){
this.chain.apply(this, arguments);
}
});
var myTodoList =new Todo(
function(){ alert('get groceries');},
function(){ alert('go workout');},
function(){ alert('code mootools documentation until eyes close
involuntarily');},
function(){ alert('sleep');}
);