{"size": 973, "ext": "js", "max_stars_repo_path": "demo/worker.js", "max_stars_repo_name": "Gaubee/worker-webrtc", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "demo/worker.js", "max_issues_repo_name": "Gaubee/worker-webrtc", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "demo/worker.js", "max_forks_repo_name": "Gaubee/worker-webrtc", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 37.4230769231, "max_line_length": 80, "alphanum_fraction": 0.6433710175}
import * as Comlink from "./comlink/esm.mjs";
import { installWorker } from './transfer.worker.js';
import { installShare } from './transfer.share.js'
installWorker(Comlink);
installShare(Comlink);

onmessage = (ev) => {
    const { data } = ev;
    if (typeof data === 'string' && data.startsWith('share-message-channel:')) {
        const cmd = data.replace('share-message-channel:', '');
        if (cmd === 'RTC') {
            const wrtc = Comlink.wrap(ev.ports[0]);
            self.RTCPeerConnection = wrtc.RTCPeerConnection;
            self.RTCDataChannel = wrtc.RTCDataChannel;
            self.RTCSessionDescription = wrtc.RTCSessionDescription;
            self.RTCIceCandidate = wrtc.RTCIceCandidate;
            self.RTCCertificate = wrtc.RTCCertificate;
            self.RTCPeerConnectionIceEvent = wrtc.RTCPeerConnectionIceEvent;
            self.RTCStatsReport = wrtc.RTCStatsReport;
        }
    }

}
import * as rtc from './rtc.js'

Comlink.expose(rtc);