Effect Ques


What is a Queue
Let’s examine how events in a queue occur:For a programmer a queue is an Aray with events that are stacked on each other to be handed one.For example,a hovers over.with th thers after.the mouseover and the mouseout.If you would handle the mouseover and the mouseout event Taes place,it could disturb your current process.However you’t just Guite theイベント,because then you will be stuck in the status that is establis by the actions You have performed for mouseover.In this situation you could the event to a queue and everry time you're done with processing ever、ject forck
How do Effects work and why do you need a Que
The same happens when you are dealing with Effects and you face the situation where two effects can be caled,both of which mappulate the same DOM oM oject(s)script.acult.compos.com the recue with severatechnignese.
何がqueueですか同じ要素に対して複数の処理効果をトリガする場合、効果が発生する順序問題を解決する必要があります.Queue列の形で平行効果を私達の順番にシリアル化します.
Effect.Que
The previous examples gave You dea of the situation s you could be facing without Ques.This must give you some motivation to find how Effect.Que could improve your live and help you to manager Effects.
Effect.Queueueue is an improved array of Effects(caled Eumerable)that is global for the entire page.It gets created byeeeeetrcting the global queeeeuuuet.Queto(we will scdiusatotowadededededededededededededededededededededededededededededededededededededededededededededededededededededededededededededewawawawawawaaaaaaaaaaaffffffffffffrerererererererered an effect to the queue?Well it's quite easy.
Effect.Queは改善されたEffects配列です.このオブジェクトの作用範囲は、ページ全体にアクセスできます.
new Effect.SlideDown('test1');
new Effect.SlideUp('test1', { queue: 'end'});
So you see I have added an array containing an entry「queue:」with the value「end」.This means that the Effect will be inserted the end of the「global」Queue.All effects are the alys the ature
queue:endがない場合、効果は並行して実行されます.
Remember that JavaScript is not multi-threaded、so blocks of code are executed together when they get parsed.This causes the effects to start in parallel ifのqueue is defined.
This works niely,doesn’t it?But what happens when you queue all kinds of effects in different placces?You could have lots of effects that you would like to queue but they don’t all relate to each other.This is where
Effect.ScoopedQue compes in.
Baic Effect.scopedQue
As explined before,the
default Queueueueue is‘global’.All effects are placced in the‘global’Queueueueueue unless Youdefine a different scope.A scope isnoththinmore grouping a set of Effects together inininininininininaaaaaaaaaaaathethethethethethethethethethethethethethethethetherererereweweweaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaレイ)This can only be done by using a different sysntax to define the Que position.
new Effect.SlideUp('menu', {queue: {position:'end', scope: 'menuxscope'} });
new Effect.SlideUp('bannerbig', {queue: {position:'end', scope: 'bannerscope'} });
new Effect.SlideDown('menu', {queue: {position: 'end', scope: 'menuxscope'} });
Limit制限行列長
Sometimes too many effects get queued,for eexample when a user preses a button twice,or repeaateeeeeeeeeeeeeeedededededenters and leaves a button hover ara(and aaaaaaaaaach time twowoeffectse e e e e e e e e e e e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeued))).Theeeeeeeeeeeeeeeeeeeeeetsare added to that ScropedQue.
new Effect.SlideDown('menu', {queue: {position:'end', scope: 'menuxscope', limit:2} }); // #1
new Effect.Highlight('menu', {queue: {position:'end', scope: 'menuxscope', limit:2} }); // #2
new Effect.SlideUp('menu', {queue: {position: 'end', scope: 'menuxscope', limit:2} });  // #3
璣1 and萼2 will be added to the queue but菗3 will not.
Effect.Ques
So what is Effect.Ques and why do we need it?ウェル、for each scope an instance of Effect.Scred Que?テクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクテクlobal,you need to fetch it using Effect.Queues.get(「mysscope」)before you can manipulate it.
私たちはEffect.Queuesから作成したQueを得ることができます.それらは全部Effect.Quesに保存されていますから.
もう
var queue = Effect.Queues.get('myscope');
ScredQue is just an Eumerable Oject.You can retrieve the effects one by one and manipulate them.Let's look at how we can'empty a queue'
var queue = Effect.Queues.get('myscope');
queue.each(function(e) { e.cancel() });
Or maybe you want to change the interval between the effects in a queue:
Effect.Queues.get('myscope').interval = 100;
もっと素晴らしい詳細?
どうぞご覧ください
http://wiki.script.aculo.us/scriptaculous/show/EffectQueues