mirror of
https://github.com/027xiguapi/code-box.git
synced 2026-05-17 07:29:03 +00:00
18 lines
436 B
TypeScript
18 lines
436 B
TypeScript
import { type PlasmoMessaging } from "@plasmohq/messaging"
|
|
|
|
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
|
try {
|
|
chrome.tabs.query({ active: true, currentWindow: true }, ([tab]) => {
|
|
const { active } = req.body
|
|
|
|
if (active) {
|
|
chrome.sidePanel.open({ tabId: tab.id })
|
|
}
|
|
})
|
|
} catch (error) {
|
|
console.error("Error toggling side panel:", error)
|
|
}
|
|
}
|
|
|
|
export default handler
|