Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ITask<T>

Represents a task that has been scheduled on a IThreadPool or is actually in execution. The task result can be retrieved by registering a callback using {@link PromiseLike.then} that is invoked with the task result. Any occurring errors are silently ignored if no explicit exception handler is registered using ITask.catch.

Type parameters

  • T

    type of the computed result

Hierarchy

Implemented by

Index

Properties

definition

definition: ITaskDefinition

The underlining task definition that describes the executed task

isCanceled

isCanceled: boolean

Indicator if this task has been canceled.

isCancellationRequested

isCancellationRequested: boolean

Indicator if this task should be canceled but has not yet

Methods

cancel

  • cancel(): void
  • Cancels the given task. Triggers an error that the task has been canceled. This has only an effect if the task has not yet been scheduled. An already scheduled task will compute till the end, but the then handler will not be invoked.

    Returns void

catch

  • catch<TResult>(onrejected: function): Promise<T | TResult>
  • catch(onrejected: function): Promise<T>
  • Attaches a callback for only the rejection of the Promise.

    Type parameters

    • TResult

    Parameters

    • onrejected: function

      The callback to execute when the Promise is rejected.

        • (reason: any): TResult | PromiseLike<TResult>
        • Parameters

          • reason: any

          Returns TResult | PromiseLike<TResult>

    Returns Promise<T | TResult>

    A Promise for the completion of the callback.

  • Attaches a callback for only the rejection of the Promise.

    Parameters

    • onrejected: function

      The callback to execute when the Promise is rejected.

        • (reason: any): T | PromiseLike<T>
        • Parameters

          • reason: any

          Returns T | PromiseLike<T>

    Returns Promise<T>

    A Promise for the completion of the callback.

then

  • then<TResult1, TResult2>(onfulfilled: function, onrejected: function): Promise<TResult1 | TResult2>
  • then<TResult>(onfulfilled: function, onrejected: function): Promise<TResult>
  • then<TResult>(onfulfilled: function): Promise<TResult>
  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type parameters

    • TResult1

    • TResult2

    Parameters

    • onfulfilled: function

      The callback to execute when the Promise is resolved.

        • (value: T): TResult1 | PromiseLike<TResult1>
        • Parameters

          • value: T

          Returns TResult1 | PromiseLike<TResult1>

    • onrejected: function

      The callback to execute when the Promise is rejected.

        • (reason: any): TResult2 | PromiseLike<TResult2>
        • Parameters

          • reason: any

          Returns TResult2 | PromiseLike<TResult2>

    Returns Promise<TResult1 | TResult2>

    A Promise for the completion of which ever callback is executed.

  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type parameters

    • TResult

    Parameters

    • onfulfilled: function

      The callback to execute when the Promise is resolved.

        • (value: T): TResult | PromiseLike<TResult>
        • Parameters

          • value: T

          Returns TResult | PromiseLike<TResult>

    • onrejected: function

      The callback to execute when the Promise is rejected.

        • (reason: any): TResult | PromiseLike<TResult>
        • Parameters

          • reason: any

          Returns TResult | PromiseLike<TResult>

    Returns Promise<TResult>

    A Promise for the completion of which ever callback is executed.

  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type parameters

    • TResult

    Parameters

    • onfulfilled: function

      The callback to execute when the Promise is resolved.

        • (value: T): TResult | PromiseLike<TResult>
        • Parameters

          • value: T

          Returns TResult | PromiseLike<TResult>

    Returns Promise<TResult>

    A Promise for the completion of which ever callback is executed.

Generated using TypeDoc