Skip to Main Content
MooTools 1.3 Cookbook
book

MooTools 1.3 Cookbook

by Jay L Johnston
July 2011
Intermediate to advanced content levelIntermediate to advanced
276 pages
5h 11m
English
Packt Publishing
Content preview from MooTools 1.3 Cookbook

Removing a chain of events

Extending upon the chain of events created in the previous section, this recipe shows us how to clear a chain of events using Chain.clearChain().

Getting ready

Get ready to call this function by adding a widget to which our clearing function can be bound.

<input type="button" id="mycancel" value="Clear Chain"/>

How to do it...

Calling the clearChain() method of the my_chain object, which is an instantiation of MooTools Chain, removes the current call stack completely.

$('mycancel').addEvent('click',function() {
alert('Clearing chain:'+my_chain.$chain.length+' actions');
my_chain.clearChain();
alert('Done! Chain has:'+my_chain.$chain.length+' actions');
});

How it works...

Each call to my_chain.chain(advance_one_number)

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Jump Start Web Performance

Jump Start Web Performance

Craig Buckler

Publisher Resources

ISBN: 9781849515689Other