Skip to the content.

jFactory > Reference > Traits > TraitTimeout

TraitTimeout

Registry / Methods / Usages

Registers timeouts that will be automatically stopped and removed at Remove Phase. The timeouts are wrapped by JFactoryPromise which makes them awaitable, thenable and expirable.

Registry

myComponent.$.timeouts

Injected Methods

$timeout(registryId {string}, delay {number} [, callback {function}, [, ...handlerArguments]])

Returns: JFactoryPromise

Defers current Phase: This method registers a Task that blocks the resolution of the current Phase (if any) until the whole Task chain (including subpromises) is resolved.

Auto completed: The promise chain is completed and expired as soon as all subpromises are resolved. This behavior can be disabled by setting anyPromiseOfTheChain.$chain.chainConfig.chainAutoComplete = false before the promise chain is completed.

Auto removed: This Subscription is removed as soon as its Promise Chain is completed.

Expires and removes the timeout registered with the key registryId previously created by $timeout(). An optional reason can be given for debugging the expired Promise Chain.

$timeoutRemoveAll(removePhase)

(Automatically called at Remove Phase)

Expires and removes any timer previously created by $timeout() if their Remove Phase match the given removePhase.

Usages