Help with showing script ui. (content.tsx) when clicking on chrome extension
Hi! I'm trying to show the script ui (modal content using a content script ui) when clicking on the chrome extension icon instead of showing a popup.
I have this in content.tsx:
my background.ts:
What I'm confused on:
- do we still have to compile the tsx/ts files to js using tsc? if so, would those compiled files be in the .plasmo or build directory?
- do we need to make any changes in package.json or tsconfig.json as well?
thanks ahead!
Jeremy•46d ago
@AP Did you figure this out ? Currently also struggling to make this work :/
@AP Figured it out you need to use the Storage hook:
In background.ts
import { Storage } from "@plasmohq/storage"
chrome.action.onClicked.addListener(async (tab) => {
console.log(" I waass clicked")
await storage.set("isOpen", true)
}) const storage = new Storage()storage.watch({
"isOpen": (c) => {
console.log(c.newValue)
},
})
In Content.tsx
const [isOpenStorage, setIsOpenStorage] = useStorage("isOpen", false)
And render conditionally on the isOpenStorageAP•39d ago
yep did something similar
2.1KMembers
View on DiscordWant results from more Discord servers?
More PostsPin Side Panel like google searchI've been searching for a way to enable a direct button for my extension Side Panel. Accessing it eaHow to listen to all HTTP requests?I'm trying to build an extension that allows me to listen to HTTP requests, much like `chrome.webReqHow do I disable the popup in dev mode?Hi, newbie here. I'm trying to make it so that I can disable/enable the popup in the options page buAdding Supabase later instead of starting with it?Hey everyone,
I started a Plasmo project initially `--with-nextjs`, now I want to use the MessagingHow to send API requests with messaging?Hey everyone,
I can't seem to figure out on my own how to send API calls using Plasmo? I see a lot Is Vanilla JavaScript supported?Hey! Does Plasmo support vanilla JavaScript only?Struggling with Plasmo Messaging API: Sending Message from CSUI to BGSW IssueHey guys, I've tried so far to understand how Plasmo Messaging API works (from CSUI to BGSW) and altHow can I listen to all requests?I am trying to create an extension that will intercept all requests that were made on the webpage. H