UNPKG

2.25 kBJavaScriptView Raw
1/*! firebase-admin v10.0.0 */
2"use strict";
3/*!
4 * Copyright 2020 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18Object.defineProperty(exports, "__esModule", { value: true });
19exports.getRemoteConfig = void 0;
20/**
21 * Firebase Remote Config.
22 *
23 * @packageDocumentation
24 */
25var app_1 = require("../app");
26var remote_config_1 = require("./remote-config");
27var remote_config_2 = require("./remote-config");
28Object.defineProperty(exports, "RemoteConfig", { enumerable: true, get: function () { return remote_config_2.RemoteConfig; } });
29/**
30 * Gets the {@link RemoteConfig} service for the default app or a given app.
31 *
32 * `getRemoteConfig()` can be called with no arguments to access the default
33 * app's `RemoteConfig` service or as `getRemoteConfig(app)` to access the
34 * `RemoteConfig` service associated with a specific app.
35 *
36 * @example
37 * ```javascript
38 * // Get the `RemoteConfig` service for the default app
39 * const defaultRemoteConfig = getRemoteConfig();
40 * ```
41 *
42 * @example
43 * ```javascript
44 * // Get the `RemoteConfig` service for a given app
45 * const otherRemoteConfig = getRemoteConfig(otherApp);
46 * ```
47 *
48 * @param app - Optional app for which to return the `RemoteConfig` service.
49 * If not provided, the default `RemoteConfig` service is returned.
50 *
51 * @returns The default `RemoteConfig` service if no
52 * app is provided, or the `RemoteConfig` service associated with the provided
53 * app.
54 */
55function getRemoteConfig(app) {
56 if (typeof app === 'undefined') {
57 app = app_1.getApp();
58 }
59 var firebaseApp = app;
60 return firebaseApp.getOrInitService('remoteConfig', function (app) { return new remote_config_1.RemoteConfig(app); });
61}
62exports.getRemoteConfig = getRemoteConfig;