UNPKG

tiny-essentials

Version:

Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.

11 lines 869 B
/** * Fetches data from a Firebase database asynchronously using the specified event type. * This function wraps the Firebase database `once` method in a Promise, allowing asynchronous handling of database responses. * * @param {firebase.database.Reference} data - The Firebase database reference from which to retrieve data. * @param {string} [type='value'] - The event type to listen for (e.g., 'value', 'child_added', 'child_changed', etc.). * @returns {Promise<firebase.database.DataSnapshot>} A promise that resolves with the snapshot data when the request is successful. * @throws {Error} If an error occurs during the database operation, the promise will be rejected with the error. */ export default function getDBAsync(data: firebase.database.Reference, type?: string): Promise<firebase.database.DataSnapshot>; //# sourceMappingURL=getDBAsync.d.mts.map