Skip to content

Commit c2f5efb

Browse files
docs: Update injectScript docs to match example from examples repo (#1240)
Co-authored-by: Aaron <[email protected]>
1 parent 4ce178c commit c2f5efb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: docs/guide/essentials/content-scripts.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -548,16 +548,21 @@ To use `injectScript`, we need two entrypoints, one content script and one unlis
548548
```ts
549549
// entrypoints/example-main-world.ts
550550
export default defineUnlistedScript(() => {
551-
console.log('Hello from the main world!');
551+
console.log('Hello from the main world');
552552
});
553553
```
554554
555555
```ts
556556
// entrypoints/example.content.ts
557-
export default defineContentScript(async () => {
558-
await injectScript('/example-main-world.js', {
559-
keepInDom: true,
560-
});
557+
export default defineContentScript({
558+
matches: ['*://*/*'],
559+
async main() {
560+
console.log('Injecting script...');
561+
await injectScript('/example-main-world.js', {
562+
keepInDom: true,
563+
});
564+
console.log('Done!');
565+
},
561566
});
562567
```
563568

0 commit comments

Comments
 (0)