@farmart-tech/brave-client-sdk
    Preparing search index...

    Class WindowReader

    Firebase-backed reader for maintenance window configurations.

    This class provides methods to fetch and subscribe to maintenance window data (FeatureRemoteConfig) from Firestore.

    const reader = new WindowReader({
    db: firestoreInstance,
    workspace: 'production'
    });

    const config = await reader.getRemoteConfig('my_app');
    if (config?.getIsInMaintenance()) {
    // handle maintenance
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    db: FirestoreDb
    prefetchPromise: Promise<unknown> | null

    Methods

    • Fetches all remote configurations in the current workspace.

      Returns Promise<Record<string, FeatureConfig> | null>

      A record of feature names to FeatureConfig instances

    • Fetches the remote configuration for a specific feature or application.

      Parameters

      • featureName: string

        The name of the feature or application

      Returns Promise<FeatureConfig | null>

      A FeatureConfig instance, or null if not found

    • Type Parameters

      • T
      • D

      Parameters

      • collection: string
      • docName: string
      • factory: (key: string, data: D) => T
      • cache: Map<string, D>

      Returns Promise<T | null>

    • Type Parameters

      • T
      • D

      Parameters

      • collection: string
      • factory: (key: string, data: D) => T
      • cache: Map<string, D>
      • allLoaded: boolean
      • OptionaluseCache: boolean

      Returns Promise<Record<string, T> | null>

    • Parameters

      • onChange: (configs: Record<string, FeatureConfig>) => void
      • OptionalonError: (error: Error) => void

      Returns Unsubscribe

    • Subscribes to real-time updates for a single remote configuration.

      Parameters

      • featureName: string

        Name of the feature to watch

      • onChange: (config: FeatureConfig | null) => void

        Callback triggered when the configuration changes

      • OptionalonError: (error: Error) => void

        Optional error callback

      Returns Unsubscribe

      Unsubscribe function