js BroadcastChannel 小案例(未测试)
export const ContractBroadcastChannel = class { channelName: string; channel: BroadcastChannel; constructor() { this.channelName = 'ContractChannel'; this.channel = window.BroadcastChannel ? new BroadcastChannel(this.channelName) : null; } postMessage = (data) => { return this.channel?.postMessage(data); }; onMessage = (data) => { return this.channel?.onmessage(data); }; };