@farmart-tech/brave-firebase-adapter
    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 = null

    Methods

    • Type Parameters

      • T
      • D

      Parameters

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

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

    • 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