BroadcastChannel: BroadcastChannel() 构造函数
注意:此功能在 Web Workers 中可用。
BroadcastChannel() 构造函数创建一个新的 BroadcastChannel 并将其连接到底层通道。
语法
js
new BroadcastChannel(channelName)
参数
示例
js
// create a new channel listening to the "internal_notification" channel.
const bc = new BroadcastChannel("internal_notification");
bc.postMessage("New listening connected!");
规范
| 规范 |
|---|
| HTML # dom-broadcastchannel-dev |
浏览器兼容性
加载中…
另见
BroadcastChannel,它所属的接口。