close session db in other tabs when opening
This commit is contained in:
parent
fc61729cb3
commit
0d622164df
1 changed files with 5 additions and 0 deletions
|
@ -23,7 +23,12 @@ const sessionName = sessionId => `hydrogen_session_${sessionId}`;
|
|||
const openDatabaseWithSessionId = sessionId => openDatabase(sessionName(sessionId), createStores, schema.length);
|
||||
|
||||
export class StorageFactory {
|
||||
constructor(serviceWorkerHandler) {
|
||||
this._serviceWorkerHandler = serviceWorkerHandler;
|
||||
}
|
||||
|
||||
async create(sessionId) {
|
||||
await this._serviceWorkerHandler?.preventConcurrentSessionAccess(sessionId);
|
||||
const db = await openDatabaseWithSessionId(sessionId);
|
||||
return new Storage(db);
|
||||
}
|
||||
|
|
Reference in a new issue