We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Sending a message from popup to background doesn't seem to work for me.
I am using this package in a Vue project.
//popup.ts import { createApp } from 'vue' import App from './Popup.vue' import '../styles' import { sendMessage } from 'webext-bridge/popup' (async () => { const resBG = await sendMessage('test-message', { text: "Popup" }, 'background') console.log(`[popup] Got ${ resBG }`); const resCS = await sendMessage('test-message', { text: "Popup" }, 'content-script') console.log(`[popup] Got ${ resCS }`); })() const app = createApp(App) app.mount('#app')
Background receives this message but throws an error:
Uncaught (in promise) TypeError: When sending messages from background page, use @tabId syntax to target specific tab
Background looks like this:
import { onMessage } from 'webext-bridge/background' onMessage('test-message', async (message) => { const { data, sender } = message console.log(`[background] Got test message from ${ sender.context }@${ sender.tabId }. Data: ${ JSON.stringify(data) } `); return `Hello` })
that console message shows:
[background] Got test message from popup@NaN. Data: [object Object]
Content script does not receive anything from the popup.
Is it possible to communicate with the popup in this way or have I got it wrong?
Thanks
The text was updated successfully, but these errors were encountered:
Closing this as I realise it is basically the same as #37
Sorry, something went wrong.
No branches or pull requests
Sending a message from popup to background doesn't seem to work for me.
I am using this package in a Vue project.
Background receives this message but throws an error:
Uncaught (in promise) TypeError: When sending messages from background page, use @tabId syntax to target specific tab
Background looks like this:
that console message shows:
[background] Got test message from popup@NaN. Data: [object Object]
Content script does not receive anything from the popup.
Is it possible to communicate with the popup in this way or have I got it wrong?
Thanks
The text was updated successfully, but these errors were encountered: