HTML5 BroadcastChannel API是在选项卡/窗口之间发送数据的绝佳解决方案。
它们通过调用函数打开new BroadcastChannel(name)
和关闭。.close()
但是,它没有说明如何查看现有打开的广播频道。如果我动态创建 BroadcastChannels(不是使用固定的频道名称),查看当前打开的 BroadcastChannels 非常有用。
在Google 上搜索(“查看现有广播频道 javascript”)并查看前三个结果(1、2、3)都没有提供有关如何查看所有打开的广播频道的指示。
我试过查看BroadcastChannel
界面,但它没有提供任何.listOpenedChannels()
功能或任何类似的东西。
如何查看现有打开的广播频道?