function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhinav Sharma.Abhinav Sharma. 

How to use BroadcastChannel to post message using Lightning Component?

Can someone share his/her experience to use BroadcastChannel to post message using Lightning Component?

I'm trying below code snippit but not working.

<aura:component implements="flexipage:availableForAllPageTypes">
    <lightning:button label="Navigate" onclick="{!c.handleClick}"/>

JavaScript Controller:
    handleClick : function(component, event, helper) {
        const channel = new BroadcastChannel("api_softphone_NavigationChange");
            messageType: "onNavigationChange"

BroadcastChannel Error
VinayVinay (Salesforce Developers) 
Hi Abhinav,

You need to access the default property

const BroadcastChannel = require('broadcast-channel').default

Also, Broadcast channel is not supported by Locker service.

Vinay Kumar