Logos DX
    Preparing search index...

    Request-scoped state bag that flows across hook runs and engine instances.

    Use symbols for private plugin state and strings for shared cross-plugin contracts.

    // Private plugin state (symbol key)
    const CACHE_STATE = Symbol('cache');
    ctx.scope.set(CACHE_STATE, { key, rule });

    // Shared cross-plugin contract (string key)
    ctx.scope.set('serializedKey', key);
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Delete a key from the scope.

      Parameters

      • key: string | symbol

      Returns boolean

    • Get a value from the scope.

      Type Parameters

      • T = unknown

      Parameters

      • key: string | symbol

      Returns T | undefined

      const state = ctx.scope.get<CacheState>(CACHE_STATE);
      
    • Check if a key exists in the scope.

      Parameters

      • key: string | symbol

      Returns boolean

    • Set a value in the scope.

      Type Parameters

      • T = unknown

      Parameters

      • key: string | symbol
      • value: T

      Returns void

      ctx.scope.set(CACHE_STATE, { key: 'abc', rule });