1// A handler that only logs the event to the console:
2bc.onmessage = function (ev) { console.log(ev); }
1// Connection to a broadcast channel
2const bc = new BroadcastChannel('test_channel');
1// Example of sending of a very simple message
2bc.postMessage('This is a test message.');