UNPKG

2.47 kBTypeScriptView Raw
1/**
2 * The Firebase Installations Web SDK.
3 * This SDK does not work in a Node.js environment.
4 *
5 * @packageDocumentation
6 */
7
8import { FirebaseApp } from '@firebase/app';
9
10/**
11 * Deletes the Firebase Installation and all associated data.
12 * @param installations - The `Installations` instance.
13 *
14 * @public
15 */
16export declare function deleteInstallations(installations: Installations): Promise<void>;
17
18/* Excluded from this release type: _FirebaseInstallationsInternal */
19
20/**
21 * Creates a Firebase Installation if there isn't one for the app and
22 * returns the Installation ID.
23 * @param installations - The `Installations` instance.
24 *
25 * @public
26 */
27export declare function getId(installations: Installations): Promise<string>;
28
29/**
30 * Returns an instance of {@link Installations} associated with the given
31 * {@link @firebase/app#FirebaseApp} instance.
32 * @param app - The {@link @firebase/app#FirebaseApp} instance.
33 *
34 * @public
35 */
36export declare function getInstallations(app?: FirebaseApp): Installations;
37
38/**
39 * Returns a Firebase Installations auth token, identifying the current
40 * Firebase Installation.
41 * @param installations - The `Installations` instance.
42 * @param forceRefresh - Force refresh regardless of token expiration.
43 *
44 * @public
45 */
46export declare function getToken(installations: Installations, forceRefresh?: boolean): Promise<string>;
47
48/**
49 * An user defined callback function that gets called when Installations ID changes.
50 *
51 * @public
52 */
53export declare type IdChangeCallbackFn = (installationId: string) => void;
54
55/**
56 * Unsubscribe a callback function previously added via {@link IdChangeCallbackFn}.
57 *
58 * @public
59 */
60export declare type IdChangeUnsubscribeFn = () => void;
61
62/**
63 * Public interface of the Firebase Installations SDK.
64 *
65 * @public
66 */
67export declare interface Installations {
68 /**
69 * The {@link @firebase/app#FirebaseApp} this `Installations` instance is associated with.
70 */
71 app: FirebaseApp;
72}
73
74/**
75 * Sets a new callback that will get called when Installation ID changes.
76 * Returns an unsubscribe function that will remove the callback when called.
77 * @param installations - The `Installations` instance.
78 * @param callback - The callback function that is invoked when FID changes.
79 * @returns A function that can be called to unsubscribe.
80 *
81 * @public
82 */
83export declare function onIdChange(installations: Installations, callback: IdChangeCallbackFn): IdChangeUnsubscribeFn;
84
85export { }