blob: 6a7e62ac55be82e2b3079ffc4d4ff43cb49bb4a3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import { getCurrentWebContents } from '@electron/remote';
const debug = require('debug')('Ferdi:Plugin:SessionHandler');
export class SessionHandler {
clearStorageData(storageLocations: string[]) {
try {
debug('Clearing storageLocations:', storageLocations);
const { session } = getCurrentWebContents();
session.flushStorageData();
session.clearStorageData({ storages: storageLocations });
} catch (err) {
debug(err);
}
}
async releaseServiceWorkers() {
try {
const registrations = await window.navigator.serviceWorker.getRegistrations();
registrations.forEach(r => {
r.unregister();
debug('ServiceWorker unregistered');
});
} catch (err) {
debug(err);
}
}
}
|