BroadcastChannel.name
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2022.
BroadcastChannel.name
は読み取り専用のプロパティで、指定されたチャンネルをその名前で一意に識別する文字列を返します。 この名前は作成時に BroadcastChannel()
コンストラクターに渡されるため、読み取り専用です。
メモ: この機能はウェブワーカー内で利用可能です。
値
文字列です。
例
js
// チャンネルに接続
const bc = new BroadcastChannel("test_channel");
// その他の操作(postMessage など)
// チャンネル名をコンソールに記録します
console.log(bc.name); // "test_channel"
// 終了したら、チャンネルから切断します
bc.close();
仕様書
Specification |
---|
HTML # dom-broadcastchannel-name-dev |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- User must explicitly enable this feature.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
BroadcastChannel
: 所属するインターフェイス。