Options
All
  • Public
  • Public/Protected
  • All
Menu

Stack Context Manager for managing the state in web it doesn't fully support the async calls though

Hierarchy

  • StackContextManager

Implements

Index

Constructors

Properties

_currentContext: Context = ROOT_CONTEXT

Keeps the reference to current context

Methods

  • bind<T>(context: Context, target: T): T
  • Binds a the certain context or the active one to the target function and then returns the target

    Type Parameters

    • T

    Parameters

    • context: Context

      A context (span) to be bind to target

    • target: T

      a function or event emitter. When target or one of its callbacks is called, the provided context will be used as the active context for the duration of the call.

    Returns T

  • with<A, F>(context: null | Context, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>
  • Calls the callback function [fn] with the provided [context]. If [context] is undefined then it will use the window. The context will be set as active

    Type Parameters

    • A extends unknown[]

    • F extends ((...args: A) => ReturnType<F>)

    Parameters

    • context: null | Context
    • fn: F

      Callback function

    • Optional thisArg: ThisParameterType<F>

      optional receiver to be used for calling fn

    • Rest ...args: A

      optional arguments forwarded to fn

    Returns ReturnType<F>

Generated using TypeDoc