serversideup/webext-bridge

sendMessage to injected script not working

Closed this issue · 1 comments

Version: 6.0.0-rc2

in content-script:
allowWindowMessaging('test')
sendMessage('hello', 'world', 'test')

in injected script(append a script element):
import { setNamespace,onMessage } from 'webext-bridge/window'
setNamespace('test')
onMessage('hello', console.log )

get error when sendMessage:
Bridge#sendMessage -> Destination must be any one of known destinations

You need to use sendMessage('hello', 'world', 'window'). Namespace 'test' is just an internal setting that webext-bridge relies on.