@nevware21/ts-debug
    Preparing search index...

    Interface IDbgUsrCtx

    The Debug user context used for passing user provided context to log records

    interface IDbgUsrCtx {
        cpy: () => IDbgUsrCtx;
        each: (cb: (name: string, value: any) => void) => void;
        get: (name: string, dfValue?: any) => any;
        has: (name: string) => boolean;
        rm: (name: string) => void;
        set: <T>(name: string, value: T) => void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Properties

    cpy: () => IDbgUsrCtx

    Return a copy of the current instance so that any changes to the current instance would not be reflected in the returned copy. The copy will contain references to the current instance keys and values, and the existing instance will also contain references the same values up until the current instance attempts to change it's current state by calling set() or rm() at which point a lazy objDeepCopy will be performed.

    So if/when the referenced values are mutable values (object/array etc) any direct changes to the value will be reflected on all references. The objDeepCopy() does not clone classes.

    Type Declaration

    each: (cb: (name: string, value: any) => void) => void

    For each key defined for the current context (and it's parent) call the provided callback function with each key name and it's value. This will only call the callback function once for each name even when the same name is presen in the current instance and it's parent.

    Type Declaration

      • (cb: (name: string, value: any) => void): void
      • Parameters

        • cb: (name: string, value: any) => void

          The callback function to call

        Returns void

    get: (name: string, dfValue?: any) => any

    Return the named context value from this instance or it's parent if present.

    Type Declaration

      • (name: string, dfValue?: any): any
      • Parameters

        • name: string

          The name of the value to return

        • OptionaldfValue: any

          If the named values does not exist in this instance or it's parent then return this value. The default will not be returned even if the value for the key is undefined or null.

        Returns any

        The value contained in the context or the default

    has: (name: string) => boolean

    Return whether the named context value is available from this instance ir it's parent.

    Type Declaration

      • (name: string): boolean
      • Parameters

        • name: string

          The name of the value to check if it's available

        Returns boolean

        true if it's present otherwise false

    rm: (name: string) => void

    Remove this named value from the context, this will cause any value from the parent to be returned again (if present) and the default value may be returned by get.

    Type Declaration

      • (name: string): void
      • Parameters

        • name: string

          The key of the value to remove

        Returns void

    set: <T>(name: string, value: T) => void

    Set the named value against the current context, this will replace any value within this instance. If the same key is present in the parent instance the value returned by the parent it not altered.

    Even if the value set is undefined / null this will still be used as an override for any parent and will be deemed to be present (so the default value for get would not be returned)

    Type Declaration

      • <T>(name: string, value: T): void
      • Type Parameters

        • T

        Parameters

        • name: string

          The key of the value to set

        • value: T

          The value to set for the given name

        Returns void