AsyncContext

Represents the context of an asynchronous operation.

  
class AsyncContext {
  static isAttached(target: object): boolean
  static merge(from: object, to: object)
  static of(target: object): AsyncContext | undefined
  id: ContextIdFactory.create()
  attachTo(target: object)
}

Static methods

isAttached()

Checks if target is already attached to any async context.


static isAttached(target: object): boolean

Parameters

Option Type Description
target object

The object to check.

Returns

boolean "true" if the target is attached to an async context, "false" otherwise.

merge()

Merges the context of an asynchronous operation from a given command, query, or event to another object.


static merge(from: object, to: object)

Parameters

Option Type Description
from object

A command, query, or event.

to object

A command, query, or event to merge the context to.

of()

Gets the context of an asynchronous operation from a given object.


static of(target: object): AsyncContext | undefined

Parameters

Option Type Description
target object

A command, query, or event.

Returns

AsyncContext | undefined An "AsyncContext" instance or "undefined" if the context is not found.

Properties

Property Description
id: ContextIdFactory.create() Read-only.

Methods

attachTo()

Attaches the context to an object.


attachTo(target: object)

Parameters

Option Type Description
target object

The object to attach the context to.