var Todo = new Class({ Implements: Chain, initialize: function() { this.chain.apply(this, arguments); this.callChain(); } }); var myTodoList = new Todo( function() { $('log').grab(new Element('p[text=get groceries]')); this.callChain(); }, function() { $('log').grab(new Element('p[text=go workout]').fade('in')); this.callChain(); }, function() { $('log').grab(new Element('p[text=code mootools documentation until eyes close involuntarily]').fade('in')); this.callChain(); }, function() { $('log').grab(new Element('p[text=sleep]')); } );
<div id="log"></div>