@react-native-firebase/app
Version:
A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto
35 lines (33 loc) • 1.04 kB
JavaScript
;
import { queueTask } from './scheduling.js';
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#dfn-database
class Database {
deletePending = false;
transactions = [];
rawObjectStores = new Map();
connections = [];
constructor(name, version) {
this.name = name;
this.version = version;
this.processTransactions = this.processTransactions.bind(this);
}
processTransactions() {
queueTask(() => {
const anyRunning = this.transactions.some(transaction => {
return transaction._started && transaction._state !== 'finished';
});
if (!anyRunning) {
const next = this.transactions.find(transaction => {
return !transaction._started && transaction._state !== 'finished';
});
if (next) {
next.addEventListener('complete', this.processTransactions);
next.addEventListener('abort', this.processTransactions);
next._start();
}
}
});
}
}
export default Database;
//# sourceMappingURL=Database.js.map