feat(clipper): Added "Clip as screenshot" switch to allow clipping content as a screenshot and save it to Files
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { tabs } from 'webextension-polyfill'
|
||||
import { RuntimeMessageReturnTypes, RuntimeMessageType } from '../types/message'
|
||||
import { RuntimeMessage, RuntimeMessageReturnTypes } from '../types/message'
|
||||
|
||||
export default async function sendMessageToActiveTab<T extends RuntimeMessageType>(
|
||||
type: T,
|
||||
): Promise<RuntimeMessageReturnTypes[T] | undefined> {
|
||||
export default async function sendMessageToActiveTab<T extends RuntimeMessage>(
|
||||
message: T,
|
||||
): Promise<RuntimeMessageReturnTypes[T['type']] | undefined> {
|
||||
const [activeTab] = await tabs.query({ active: true, currentWindow: true, windowType: 'normal' })
|
||||
|
||||
if (!activeTab || !activeTab.id) {
|
||||
return
|
||||
}
|
||||
|
||||
return await tabs.sendMessage(activeTab.id, { type })
|
||||
return await tabs.sendMessage(activeTab.id, message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user