From 135082606efd4d249489218b31cf8a7567dd293d Mon Sep 17 00:00:00 2001 From: Hakadao Date: Mon, 14 Oct 2024 12:06:38 +0800 Subject: [PATCH] refactor: tab.ts => tabs.ts --- src/background/index.ts | 2 +- src/background/messageListeners/{tab.ts => tabs.ts} | 4 ++-- .../VideoCard/VideoCardContextMenu/VideoCardContextMenu.vue | 2 +- src/utils/{tab.ts => tabs.ts} | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename src/background/messageListeners/{tab.ts => tabs.ts} (84%) rename src/utils/{tab.ts => tabs.ts} (54%) diff --git a/src/background/index.ts b/src/background/index.ts index 1348d052..5c67ff52 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -1,7 +1,7 @@ import browser from 'webextension-polyfill' import { setupApiMsgLstnrs } from './messageListeners/api' -import { setupTabMsgLstnrs } from './messageListeners/tab' +import { setupTabMsgLstnrs } from './messageListeners/tabs' browser.runtime.onInstalled.addListener((): void => { // eslint-disable-next-line no-console diff --git a/src/background/messageListeners/tab.ts b/src/background/messageListeners/tabs.ts similarity index 84% rename from src/background/messageListeners/tab.ts rename to src/background/messageListeners/tabs.ts index 5e17384a..5cb92a55 100644 --- a/src/background/messageListeners/tab.ts +++ b/src/background/messageListeners/tabs.ts @@ -5,12 +5,12 @@ interface Message { [key: string]: any } -export enum TAB_MESSAGE { +export enum TABS_MESSAGE { OPEN_LINK_IN_BACKGROUND = 'openLinkInBackground', } function handleMessage(message: Message) { - if (message.contentScriptQuery === TAB_MESSAGE.OPEN_LINK_IN_BACKGROUND) { + if (message.contentScriptQuery === TABS_MESSAGE.OPEN_LINK_IN_BACKGROUND) { return browser.tabs.create({ url: message.url, active: false }) } } diff --git a/src/components/VideoCard/VideoCardContextMenu/VideoCardContextMenu.vue b/src/components/VideoCard/VideoCardContextMenu/VideoCardContextMenu.vue index db590760..8b806fe3 100644 --- a/src/components/VideoCard/VideoCardContextMenu/VideoCardContextMenu.vue +++ b/src/components/VideoCard/VideoCardContextMenu/VideoCardContextMenu.vue @@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n' import { useBewlyApp } from '~/composables/useAppProvider' import { Type as ThreePointV2Type } from '~/models/video/appForYou' -import { openLinkInBackground } from '~/utils/tab' +import { openLinkInBackground } from '~/utils/tabs' import type { Video } from '../VideoCard.vue' import DislikeDialog from './components/DislikeDialog.vue' diff --git a/src/utils/tab.ts b/src/utils/tabs.ts similarity index 54% rename from src/utils/tab.ts rename to src/utils/tabs.ts index bc68bd25..cf403617 100644 --- a/src/utils/tab.ts +++ b/src/utils/tabs.ts @@ -1,10 +1,10 @@ import browser from 'webextension-polyfill' -import { TAB_MESSAGE } from '~/background/messageListeners/tab' +import { TABS_MESSAGE } from '~/background/messageListeners/tabs' export function openLinkInBackground(url: string) { return browser.runtime.sendMessage({ - contentScriptQuery: TAB_MESSAGE.OPEN_LINK_IN_BACKGROUND, + contentScriptQuery: TABS_MESSAGE.OPEN_LINK_IN_BACKGROUND, url, }) }