Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc]: The example is misleading regarding the input parameters #92

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tachibana-shin
Copy link
Contributor

image

I'm developing an OSS project, but unfortunately it doesn't have typescript. I opened the documentation and realized the example is very misleading

import { sendMessage, onMessage } from "webext-bridge/popup";
const response = await sendMessage("ACTION", {
    data: data
}, "background");

This causes the misunderstanding that we need to pass the argument as an object with data. It is a big misunderstanding that we just need to

import { sendMessage, onMessage } from "webext-bridge/popup";
const response = await sendMessage("ACTION", data, "background");

If we follow the example, background ({ data }) will be an object with a data field containing the data of sendMessage lmao

import { sendMessage, onMessage } from "webext-bridge/popup";
const response = await sendMessage("ACTION", {
    data: data
}, "background");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant