UNPKG

2.57 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2019 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import { FirebaseApp } from '@firebase/app-types';
18import { RemoteConfig as RemoteConfigType, FetchStatus, Settings, Value as ValueType, LogLevel as RemoteConfigLogLevel } from '@firebase/remote-config-types';
19import { StorageCache } from './storage/storage_cache';
20import { RemoteConfigFetchClient } from './client/remote_config_fetch_client';
21import { Storage } from './storage/storage';
22import { Logger } from '@firebase/logger';
23/**
24 * Encapsulates business logic mapping network and storage dependencies to the public SDK API.
25 *
26 * See {@link https://github.com/FirebasePrivate/firebase-js-sdk/blob/master/packages/firebase/index.d.ts|interface documentation} for method descriptions.
27 */
28export declare class RemoteConfig implements RemoteConfigType {
29 readonly app: FirebaseApp;
30 private readonly _client;
31 private readonly _storageCache;
32 private readonly _storage;
33 private readonly _logger;
34 private _isInitializationComplete;
35 private _initializePromise?;
36 settings: Settings;
37 defaultConfig: {
38 [key: string]: string | number | boolean;
39 };
40 setLogLevel(logLevel: RemoteConfigLogLevel): void;
41 get fetchTimeMillis(): number;
42 get lastFetchStatus(): FetchStatus;
43 constructor(app: FirebaseApp, _client: RemoteConfigFetchClient, _storageCache: StorageCache, _storage: Storage, _logger: Logger);
44 activate(): Promise<boolean>;
45 ensureInitialized(): Promise<void>;
46 /**
47 * @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than
48 * {@link Settings.fetchTimeoutInSeconds} or
49 * {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.
50 */
51 fetch(): Promise<void>;
52 fetchAndActivate(): Promise<boolean>;
53 getAll(): {
54 [key: string]: ValueType;
55 };
56 getBoolean(key: string): boolean;
57 getNumber(key: string): number;
58 getString(key: string): string;
59 getValue(key: string): ValueType;
60}