web api instance property
BroadcastChannel: name property
Available in workers
The name read-only property of the BroadcastChannel interface returns a string, which uniquely identifies the given channel with its name. This name is passed to the BroadcastChannel() constructor at creation time and is therefore read-only.
Values
A string.
Examples
// Connect to a channel
const bc = new BroadcastChannel("test_channel");
// More operations (like postMessage, …)
// Log the channel name to the console
console.log(bc.name); // "test_channel"
// When done, disconnect from the channel
bc.close();
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
BroadcastChannel, the interface it belongs to.