From da795364568865d504bf7fd27383adaca70ffed2 Mon Sep 17 00:00:00 2001 From: Thomas Howlett <1786243+howlettt@users.noreply.github.com> Date: Tue, 15 Jul 2025 17:56:58 -0600 Subject: [PATCH] docs: correct content script example code (#1811) --- CONTRIBUTING.md | 2 +- docs/guide/essentials/entrypoints.md | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8f70ece8..75c33270 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -182,5 +182,5 @@ Anyone is welcome to submit a blog post on ! > [!NOTE] > Before starting on a blog post, please message Aaron on Discord or start a discussion on GitHub to get permission to write about a topic, but most topics are welcome: Major version updates, tutorials, etc. -- **English only**: Blog posts should be written in English. Unfortunately, our maintainers doesn't have the bandwidth right now to translate our docs, let alone blog posts. Sorry 😓 +- **English only**: Blog posts should be written in English. Unfortunately, our maintainers don't have the bandwidth right now to translate our docs, let alone blog posts. Sorry 😓 - **AI**: Please only use AI to translate or proof-read your blog post. Don't generate the whole thing... We don't want to publish that. diff --git a/docs/guide/essentials/entrypoints.md b/docs/guide/essentials/entrypoints.md index 258fb2ce..17d448f1 100644 --- a/docs/guide/essentials/entrypoints.md +++ b/docs/guide/essentials/entrypoints.md @@ -300,14 +300,14 @@ When defining content script entrypoints, keep in mind that WXT will import this ```ts -browser.runtime.onMessage.addListener((message) => { // [!code --] - // ... // [!code --] -}); // [!code --] +const container = document.createElement('div'); // [!code --] +document.body.append(container); // [!code --] -export default defineBackground(() => { - browser.runtime.onMessage.addListener((message) => { // [!code ++] - // ... // [!code ++] - }); // [!code ++] +export default defineContentScript({ + main: function () { + const container = document.createElement('div'); // [!code ++] + document.body.append(container); // [!code ++] + }, }); ```