Rob
Rob
PD🧩 Plasmo Developers
Created by frostman on 2/9/2024 in #👟framework
Pin Side Panel like google search
If you get rid of your popup file and put the following code in your BGSW (background.ts), it will make it so the "action" button open the sidepanel directly, which can then be pinned
chrome.action.onClicked.addListener((tab) =>
chrome.sidePanel.open({ windowId: tab.windowId })
);
chrome.action.onClicked.addListener((tab) =>
chrome.sidePanel.open({ windowId: tab.windowId })
);
5 replies
PD🧩 Plasmo Developers
Created by Erskine Williams on 4/26/2024 in #🔰newbie
Loading a content script on a specific tab
No problem!
5 replies
PD🧩 Plasmo Developers
Created by Erskine Williams on 4/26/2024 in #🔰newbie
Loading a content script on a specific tab
In my BGSW, I did this:
import contentTs from "url:~contents/content.ts";

const getFilenameFromImport = (fullFileName: string) => {
const split = fullFileName.split("/").pop();
if (split === undefined)
throw new Error(
`Issue parsing filename in background.ts: ${fullFileName}`
);
const filename = split.split("?")[0];
return filename;
};

const contentTsFilename = getFilenameFromImport(contentTs);
import contentTs from "url:~contents/content.ts";

const getFilenameFromImport = (fullFileName: string) => {
const split = fullFileName.split("/").pop();
if (split === undefined)
throw new Error(
`Issue parsing filename in background.ts: ${fullFileName}`
);
const filename = split.split("?")[0];
return filename;
};

const contentTsFilename = getFilenameFromImport(contentTs);
Then I passed contentTsFilename to chrome.scripting.executeScript. As far as I know, there isn't a more "official" way of doing this
5 replies