-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
The documentation says that we're supposed to use defineWindowMessaging
in order to communicate with an iFrame, but since it's missing an example, I can't figure out what's missing, but I never seem to receive the message.
// content script
import { windowMessaging } from '@/windowMessaging';
export default defineContentScript({
matches: ['<all_urls>'],
main(ctx) {
// Define the UI
const ui = createIframeUi(ctx, {
page: '/app.html',
position: 'inline',
anchor: 'body',
});
// Show UI to user
ui.mount();
setTimeout(() => {
console.log('content: sending test');
windowMessaging.sendMessage('test', undefined);
}, 5000);
},
});
// iframe
import { windowMessaging } from '@/windowMessaging';
windowMessaging.onMessage('test', () => {
console.log('iframe: received test');
});
Metadata
Metadata
Assignees
Labels
No labels