diff options
Diffstat (limited to 'src/background/presenters')
-rw-r--r-- | src/background/presenters/IndicatorPresenter.ts | 2 | ||||
-rw-r--r-- | src/background/presenters/NotifyPresenter.ts | 8 | ||||
-rw-r--r-- | src/background/presenters/TabPresenter.ts | 22 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/background/presenters/IndicatorPresenter.ts b/src/background/presenters/IndicatorPresenter.ts index 99f92b5..6a33e62 100644 --- a/src/background/presenters/IndicatorPresenter.ts +++ b/src/background/presenters/IndicatorPresenter.ts @@ -3,7 +3,7 @@ import { injectable } from 'tsyringe'; @injectable() export default class IndicatorPresenter { indicate(enabled: boolean): Promise<void> { - let path = enabled + const path = enabled ? 'resources/enabled_32x32.png' : 'resources/disabled_32x32.png'; if (typeof browser.browserAction.setIcon === 'function') { diff --git a/src/background/presenters/NotifyPresenter.ts b/src/background/presenters/NotifyPresenter.ts index defb601..b7f4f99 100644 --- a/src/background/presenters/NotifyPresenter.ts +++ b/src/background/presenters/NotifyPresenter.ts @@ -6,8 +6,8 @@ const NOTIFICATION_ID_INVALID_SETTINGS = 'vimvixen-update-invalid-settings'; @injectable() export default class NotifyPresenter { async notifyUpdated(version: string, onclick: () => void): Promise<void> { - let title = `Vim Vixen ${version} has been installed`; - let message = 'Click here to see release notes'; + const title = `Vim Vixen ${version} has been installed`; + const message = 'Click here to see release notes'; const listener = (id: string) => { if (id !== NOTIFICATION_ID_UPDATE) { @@ -27,9 +27,9 @@ export default class NotifyPresenter { } async notifyInvalidSettings(onclick: () => void): Promise<void> { - let title = `Loaded settings is invalid`; + const title = `Loaded settings is invalid`; // eslint-disable-next-line max-len - let message = 'The default settings is used due to the last saved settings is invalid. Check your current settings from the add-on preference'; + const message = 'The default settings is used due to the last saved settings is invalid. Check your current settings from the add-on preference'; const listener = (id: string) => { if (id !== NOTIFICATION_ID_INVALID_SETTINGS) { diff --git a/src/background/presenters/TabPresenter.ts b/src/background/presenters/TabPresenter.ts index ed88f26..33d8bea 100644 --- a/src/background/presenters/TabPresenter.ts +++ b/src/background/presenters/TabPresenter.ts @@ -17,7 +17,7 @@ export default class TabPresenter { } async getCurrent(): Promise<Tab> { - let tabs = await browser.tabs.query({ + const tabs = await browser.tabs.query({ active: true, currentWindow: true }); return tabs[0]; @@ -28,8 +28,8 @@ export default class TabPresenter { } async getLastSelectedId(): Promise<number | undefined> { - let cache = new MemoryStorage(); - let tabId = await cache.get(LAST_SELECTED_KEY); + const cache = new MemoryStorage(); + const tabId = await cache.get(LAST_SELECTED_KEY); if (tabId === null || typeof tabId === 'undefined') { return; } @@ -37,9 +37,9 @@ export default class TabPresenter { } async getByKeyword( - keyword: string, excludePinned: boolean = false, + keyword: string, excludePinned = false, ): Promise<Tab[]> { - let tabs = await browser.tabs.query({ currentWindow: true }); + const tabs = await browser.tabs.query({ currentWindow: true }); return tabs.filter((t) => { return t.url && t.url.toLowerCase().includes(keyword.toLowerCase()) || t.title && t.title.toLowerCase().includes(keyword.toLowerCase()); @@ -57,9 +57,9 @@ export default class TabPresenter { } async reopen(): Promise<any> { - let window = await browser.windows.getCurrent(); - let sessions = await browser.sessions.getRecentlyClosed(); - let session = sessions.find((s) => { + const window = await browser.windows.getCurrent(); + const sessions = await browser.sessions.getRecentlyClosed(); + const session = sessions.find((s) => { return s.tab && s.tab.windowId === window.id; }); if (!session) { @@ -100,11 +100,11 @@ export default class TabPresenter { } } -let tabPresenter = new TabPresenter(); +const tabPresenter = new TabPresenter(); tabPresenter.onSelected((tab: any) => { - let cache = new MemoryStorage(); + const cache = new MemoryStorage(); - let lastId = cache.get(CURRENT_SELECTED_KEY); + const lastId = cache.get(CURRENT_SELECTED_KEY); if (lastId) { cache.set(LAST_SELECTED_KEY, lastId); } |