Trigger a function when opening the Popup?
I know you can create a popup.tsx file, to show JSX when clicking on the extension icon. Is it possible to trigger a function instead of render content, when clicking on the extension icon? For example, when user clicks on the extension icon, instead of showing content in the popup window - trigger a function to change storage state?
Thanks in advance
7 Replies
Yeah, you can do this in background.ts:
Make sure to remove popup.tsx
Thanks a lot
Hello!
chrome.action.onClicked
is a chrome API and not working with firefox.
Is there a plasmo abstraction of browser action that works on both chrome and firefox? 🙏Hey, I am working with Pikaq, does someone have an answer here? Thanks!
Gave +1 Rep to @Pikaq
GitHub
GitHub - mozilla/webextension-polyfill: A lightweight polyfill libr...
A lightweight polyfill library for Promise-based WebExtension APIs in Chrome - GitHub - mozilla/webextension-polyfill: A lightweight polyfill library for Promise-based WebExtension APIs in Chrome