Skip to the content.

jFactory > Reference > Traits > TraitTask

TraitTask

Registry / Methods / Usages

Registers Promises wrapped by JFactoryPromise objects that will be expired and removed at Remove Phase.

Behavior

See also JFactoryPromise, TraitService

Registry

myComponent.$.tasks

Injected Methods

$task(registryId {string}, executorOrValue {Promise | function | *})

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.

$taskRemoveAll(phase)

(Automatically called at Remove Phase)

Removes any promise previously created by $task() if their Remove Phase match the given phase.

$taskPromiseAll(autoComplete = false)

Returns a Promise that fulfills when all the registered tasks fulfill.
If autoComplete is true, the chainAutoComplete is enabled on all tasks.

Usages