value, Adds a method to inject pauses between chained events.
(function(){
var wait = {
wait: function(duration){
return this.chain(function(){
this.callChain.delay(duration == null ? 500 : duration, this);
}.bind(this));
}
};
Chain.implement(wait);
if (window.Fx){
Fx.implement(wait);
['Css', 'Tween', 'Elements'].each(function(cls){
if (Fx[cls]) Fx[cls].implement(wait);
});
}
Element.implement({
chains: function(effects){
Array.from(effects || ['tween', 'morph', 'reveal']).each(function(effect){
effect = this.get(effect);
if (!effect) return;
effect.setOptions({
link:'chain'
});
}, this);
return this;
},
pauseFx: function(duration, effect){
this.chains(effect).get(effect || 'tween').wait(duration);
return this;
}
});
})();