From c2f5efbde4166cb594c69c6734850d9dda5244e7 Mon Sep 17 00:00:00 2001 From: spookyuser <16196262+spookyuser@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:23:33 +0200 Subject: [PATCH] docs: Update `injectScript` docs to match example from examples repo (#1240) Co-authored-by: Aaron --- docs/guide/essentials/content-scripts.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/guide/essentials/content-scripts.md b/docs/guide/essentials/content-scripts.md index e8b350d9..584c90eb 100644 --- a/docs/guide/essentials/content-scripts.md +++ b/docs/guide/essentials/content-scripts.md @@ -548,16 +548,21 @@ To use `injectScript`, we need two entrypoints, one content script and one unlis ```ts // entrypoints/example-main-world.ts export default defineUnlistedScript(() => { - console.log('Hello from the main world!'); + console.log('Hello from the main world'); }); ``` ```ts // entrypoints/example.content.ts -export default defineContentScript(async () => { - await injectScript('/example-main-world.js', { - keepInDom: true, - }); +export default defineContentScript({ + matches: ['*://*/*'], + async main() { + console.log('Injecting script...'); + await injectScript('/example-main-world.js', { + keepInDom: true, + }); + console.log('Done!'); + }, }); ```