refactor: tab.ts => tabs.ts

This commit is contained in:
Hakadao
2024-10-14 12:06:38 +08:00
parent 4f99873baa
commit 135082606e
4 changed files with 6 additions and 6 deletions

View File

@@ -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

View File

@@ -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 })
}
}

View File

@@ -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'

View File

@@ -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,
})
}