Files
holesail-browser/extension/content.js
T
Raven Scott d58a0b6e2d
CI / Build & Test (push) Has been cancelled
first commit
2026-02-27 18:13:59 -05:00

15 lines
586 B
JavaScript

/**
* Content script: bridges native host events to the page and subscribes to tunnel events.
*/
const browser = typeof chrome !== 'undefined' && chrome.runtime?.sendMessage ? chrome : typeof browser !== 'undefined' ? browser : chrome;
// Subscribe to native host events (tunnel ready/closed/error, etc.)
browser.runtime.sendMessage({ target: 'holesail-native', action: 'subscribe' }, () => {});
browser.runtime.onMessage.addListener((message) => {
if (message.type === 'holesail-host-disconnect') {
window.dispatchEvent(new CustomEvent('holesail-host-disconnect'));
}
});