From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/ko/web/api/broadcastchannel/index.html | 92 ++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 files/ko/web/api/broadcastchannel/index.html (limited to 'files/ko/web/api/broadcastchannel/index.html') diff --git a/files/ko/web/api/broadcastchannel/index.html b/files/ko/web/api/broadcastchannel/index.html new file mode 100644 index 0000000000..a229e41829 --- /dev/null +++ b/files/ko/web/api/broadcastchannel/index.html @@ -0,0 +1,92 @@ +--- +title: BroadcastChannel +slug: Web/API/BroadcastChannel +tags: + - API + - Broadcast Channel API + - Experimental + - HTML API + - Interface + - Reference +translation_of: Web/API/BroadcastChannel +--- +

{{APIRef("Broadcast Channel API")}}

+ +

The BroadcastChannel interface represents a named channel that any {{glossary("browsing context")}} of a given {{glossary("origin")}} can subscribe to. It allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin. Messages are broadcasted via a {{event("message")}} event fired at all BroadcastChannel objects listening to the channel.

+ +

{{AvailableInWorkers}}

+ +

Constructor

+ +
+
{{domxref("BroadcastChannel.BroadcastChannel", "BroadcastChannel()")}}
+
Creates an object linking to the named channel.
+
+ +

Properties

+ +

This interface also inherits properties from its parent, {{domxref("EventTarget")}}.

+ +
+
{{domxref("BroadcastChannel.name")}}
+
Returns a {{domxref("DOMString")}}, the name of the channel.
+
+

Event handlers

+
+
{{domxref("BroadcastChannel.onmessage")}}
+
An {{domxref("EventHandler")}} property that specifies the function to execute when a {{event("message")}} event is fired on this object.
+
{{domxref("BroadcastChannel.onmessageerror")}}
+
An {{domxref("EventHandler")}} called when a {{domxref("MessageEvent")}} of type {{domxref("MessageError")}} is fired—that is, when it receives a message that cannot be deserialized.
+
+ +

Methods

+ +

This interface also inherits methods from its parent, {{domxref("EventTarget")}}.

+ +
+
{{domxref("BroadcastChannel.postMessage()")}}
+
Sends the message, of any type of object, to each BroadcastChannel object listening to the same channel.
+
{{domxref("BroadcastChannel.close()")}}
+
Closes the channel object, indicating it won't get any new messages, and allowing it to be, eventually, garbage collected.
+
+ +

Events

+ +
+
message
+
Fired when when a message arrives on the channel.
+ Also available via the onmessage property.
+
messageerror
+
Fired when a message arrives that can't be deserialized.
+ Also available via the onmessageerror property.
+
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', "comms.html#broadcastchannel", "BroadcastChannel")}}{{Spec2('HTML WHATWG')}}Initial definition.
+ +

Browser compatibility

+ + + +

{{Compat("api.BroadcastChannel")}}

+ +

See also

+ + -- cgit v1.2.3-54-g00ecf