1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

IdleBackground, clean up lock service chrome refs

This commit is contained in:
Kyle Spearrin
2018-01-04 17:04:26 -05:00
parent 2986bd1e29
commit 2ef937f333
3 changed files with 35 additions and 12 deletions

View File

@@ -14,18 +14,6 @@ export default class LockService {
private setIcon: Function, private refreshBadgeAndMenu: Function) {
this.checkLock();
setInterval(() => this.checkLock(), 10 * 1000); // check every 10 seconds
const self = this;
if ((window as any).chrome.idle && (window as any).chrome.idle.onStateChanged) {
(window as any).chrome.idle.onStateChanged.addListener(async (newState: string) => {
if (newState === 'locked') {
const lockOption = await this.storageService.get<number>(ConstantsService.lockOptionKey);
if (lockOption === -2) {
self.lock();
}
}
});
}
}
async checkLock(): Promise<void> {