Pot.Deferred.till

{Pot.Deferred} Pot.Deferred.till ({Function|*} cond)

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

条件式 cond が 真 (true) を返すまで待機します。

引数 cond は、真偽値を返す関数 または任意の値を指定します。
この関数は Pot.Deferred インスタンスを返し、
cond が 真 (true) となる値を返すまで 返されたインスタンスは実行されません。
チェイン上の till() と同じように扱えます。
Pot.globalize() が適応済みの場合、Pot.Deferred.till() が till() で実行できます。

新しい Pot.Deferred インスタンスを返します。

Pot.debug('Begin till');

Pot.Deferred.till(function() {
    // body が読み込まれるまで待機
    if (!document.body) {
        return false;
    } else {
        return true;
    }
}).then(function() {
    Pot.debug('End till');
    document.body.innerHTML += 'hoge';
});