You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Woking with lots of PouchDB local databases. PouchDB docs says that if DB already exists it will be returned when called new PouchDB, the issue I have is that I´m not sure if it is okey to get databases by calling new PouchDB every time or should I store database objects in some place?
Would it be too taxing to call this function every time I want to get a database?
public static init<T = any>(name: string): DatabaseInterface<T> {
PouchDB.plugin(PouchDBAdapter);
PouchDB.plugin(PouchDBFind);
PouchDB.plugin(PouchDBResolveConflicts);
let databaseName = name + '.db';
// use md5 to parse database name
if (environment.production) {
databaseName = Md5.hashStr(databaseName) as string;
}
const database = new PouchDB<T>(databaseName, {
adapter: 'cordova-sqlite',
revs_limit: 1,
auto_compaction: true
});
return database;
}
Haven´t managed to find any confirmation on this topic.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Greetings!
Woking with lots of PouchDB local databases. PouchDB docs says that if DB already exists it will be returned when called new PouchDB, the issue I have is that I´m not sure if it is okey to get databases by calling new PouchDB every time or should I store database objects in some place?
Would it be too taxing to call this function every time I want to get a database?
Haven´t managed to find any confirmation on this topic.
Beta Was this translation helpful? Give feedback.
All reactions