mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
close session db in other tabs when opening
This commit is contained in:
parent
fc61729cb3
commit
0d622164df
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user