UNPKG

2.28 kBJavaScriptView Raw
1/*! firebase-admin v10.0.0 */
2"use strict";
3/*!
4 * Copyright 2021 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.getInstallations = exports.Installations = void 0;
20/**
21 * Firebase Instance ID service.
22 *
23 * @packageDocumentation
24 */
25var index_1 = require("../app/index");
26var installations_1 = require("./installations");
27Object.defineProperty(exports, "Installations", { enumerable: true, get: function () { return installations_1.Installations; } });
28/**
29 * Gets the {@link Installations} service for the default app or a given app.
30 *
31 * `getInstallations()` can be called with no arguments to access the default
32 * app's `Installations` service or as `getInstallations(app)` to access the
33 * `Installations` service associated with a specific app.
34 *
35 * @example
36 * ```javascript
37 * // Get the Installations service for the default app
38 * const defaultInstallations = getInstallations();
39 * ```
40 *
41 * @example
42 * ```javascript
43 * // Get the Installations service for a given app
44 * const otherInstallations = getInstallations(otherApp);
45 *```
46 *
47 * @param app - Optional app whose `Installations` service to
48 * return. If not provided, the default `Installations` service will be
49 * returned.
50 *
51 * @returns The default `Installations` service if
52 * no app is provided or the `Installations` service associated with the
53 * provided app.
54 */
55function getInstallations(app) {
56 if (typeof app === 'undefined') {
57 app = index_1.getApp();
58 }
59 var firebaseApp = app;
60 return firebaseApp.getOrInitService('installations', function (app) { return new installations_1.Installations(app); });
61}
62exports.getInstallations = getInstallations;