installations package

The Firebase Installations Web SDK. This SDK does not work in a Node.js environment.

Functions

Function Description
function(app, ...)
getInstallations(app) Returns an instance of Installations associated with the given FirebaseApp instance.
function(installations, ...)
deleteInstallations(installations) Deletes the Firebase Installation and all associated data.
getId(installations) Creates a Firebase Installation if there isn't one for the app and returns the Installation ID.
getToken(installations, forceRefresh) Returns a Firebase Installations auth token, identifying the current Firebase Installation.
onIdChange(installations, callback) Sets a new callback that will get called when Installation ID changes. Returns an unsubscribe function that will remove the callback when called.

Interfaces

Interface Description
Installations Public interface of the Firebase Installations SDK.

Type Aliases

Type Alias Description
IdChangeCallbackFn An user defined callback function that gets called when Installations ID changes.
IdChangeUnsubscribeFn Unsubscribe a callback function previously added via IdChangeCallbackFn.

function(app, ...)

getInstallations(app)

Returns an instance of Installations associated with the given FirebaseApp instance.

Signature:

export declare function getInstallations(app?: FirebaseApp): Installations;

Parameters

Parameter Type Description
app FirebaseApp The FirebaseApp instance.

Returns:

Installations

function(installations, ...)

deleteInstallations(installations)

Deletes the Firebase Installation and all associated data.

Signature:

export declare function deleteInstallations(installations: Installations): Promise<void>;

Parameters

Parameter Type Description
installations Installations The Installations instance.

Returns:

Promise<void>

getId(installations)

Creates a Firebase Installation if there isn't one for the app and returns the Installation ID.

Signature:

export declare function getId(installations: Installations): Promise<string>;

Parameters

Parameter Type Description
installations Installations The Installations instance.

Returns:

Promise<string>

getToken(installations, forceRefresh)

Returns a Firebase Installations auth token, identifying the current Firebase Installation.

Signature:

export declare function getToken(installations: Installations, forceRefresh?: boolean): Promise<string>;

Parameters

Parameter Type Description
installations Installations The Installations instance.
forceRefresh boolean Force refresh regardless of token expiration.

Returns:

Promise<string>

onIdChange(installations, callback)

Sets a new callback that will get called when Installation ID changes. Returns an unsubscribe function that will remove the callback when called.

Signature:

export declare function onIdChange(installations: Installations, callback: IdChangeCallbackFn): IdChangeUnsubscribeFn;

Parameters

Parameter Type Description
installations Installations The Installations instance.
callback IdChangeCallbackFn The callback function that is invoked when FID changes.

Returns:

IdChangeUnsubscribeFn

A function that can be called to unsubscribe.

IdChangeCallbackFn

An user defined callback function that gets called when Installations ID changes.

Signature:

export type IdChangeCallbackFn = (installationId: string) => void;

IdChangeUnsubscribeFn

Unsubscribe a callback function previously added via IdChangeCallbackFn.

Signature:

export type IdChangeUnsubscribeFn = () => void;