BroadcastChannel: close() Methode
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.
Hinweis: Diese Funktion ist in Web Workers verfügbar.
Die close()
-Methode des BroadcastChannel
-Interfaces beendet die Verbindung zum zugrunde liegenden Kanal, sodass das Objekt vom Garbage Collector aufgeräumt werden kann. Dies ist ein notwendiger Schritt, da es keine andere Möglichkeit für einen Browser gibt zu wissen, dass dieser Kanal nicht mehr benötigt wird.
Syntax
close()
Beispiele
// Connect to a channel
const bc = new BroadcastChannel("test_channel");
// More operations (like postMessage, …)
// When done, disconnect from the channel
bc.close();
Spezifikationen
Specification |
---|
HTML # dom-broadcastchannel-close-dev |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
close |
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.
Siehe auch
BroadcastChannel
, das Interface, zu dem es gehört.