Pot.Deferred.prototype.speed

{Pot.Deferred|Number|*} Pot.Deferred.prototype.speed ({Number|String} sp)

Pot.js と PotLite.js で利用可能。

各チェイン間の実行速度を設定または取得します。

Deferred チェイン間の実行スピードを設定、または取得します。
引数 sp には、文字列定数での速度指定 またはミリ秒単位の数値で設定します。
定義されている速度値については、下の表 を参照ください。

値 / メソッド名 速度
limp 最も遅い
doze 遅い
slow 遅め
normal 通常
fast 速め
rapid 速い
ninja 最も速い

実行時の Pot.Deferred インスタンスが返ります。
引数に何も渡さないでコールすると、現在の速度が返ります。

var n = 0;
var testFunc = function() { debug(++n); };
var d = new Pot.Deferred();

d.then(testFunc).then(testFunc).then(testFunc)
 .then(function() { debug('最も遅い速度に変更 (limp)'); })
 .speed('limp')
 .then(testFunc).then(testFunc).then(testFunc)
 .then(function() { debug('50 ミリ秒に設定'); })
 .speed(50)
 .then(testFunc).then(testFunc).then(testFunc)
 .then(function() { debug('End'); })
 .begin();