aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/broadcastchannel/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ko/web/api/broadcastchannel/index.html')
-rw-r--r--files/ko/web/api/broadcastchannel/index.html92
1 files changed, 92 insertions, 0 deletions
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
+---
+<p>{{APIRef("Broadcast Channel API")}}</p>
+
+<p>The <code><strong>BroadcastChannel</strong></code> 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 <code>BroadcastChannel</code> objects listening to the channel.</p>
+
+<p>{{AvailableInWorkers}}</p>
+
+<h2 id="Constructor">Constructor</h2>
+
+<dl>
+ <dt>{{domxref("BroadcastChannel.BroadcastChannel", "BroadcastChannel()")}}</dt>
+ <dd>Creates an object linking to the named channel.</dd>
+</dl>
+
+<h2 id="Properties">Properties</h2>
+
+<p><em>This interface also inherits properties from its parent, {{domxref("EventTarget")}}.</em></p>
+
+<dl>
+ <dt>{{domxref("BroadcastChannel.name")}}</dt>
+ <dd>Returns a {{domxref("DOMString")}}, the name of the channel.</dd>
+ <dt>
+ <h3 id="Event_handlers">Event handlers</h3>
+ </dt>
+ <dt>{{domxref("BroadcastChannel.onmessage")}}</dt>
+ <dd>An {{domxref("EventHandler")}} property that specifies the function to execute when a {{event("message")}} event is fired on this object.</dd>
+ <dt>{{domxref("BroadcastChannel.onmessageerror")}}</dt>
+ <dd>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.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<p><em>This interface also inherits methods from its parent, {{domxref("EventTarget")}}.</em></p>
+
+<dl>
+ <dt>{{domxref("BroadcastChannel.postMessage()")}}</dt>
+ <dd>Sends the message, of any type of object, to each <code>BroadcastChannel</code> object listening to the same channel.</dd>
+ <dt>{{domxref("BroadcastChannel.close()")}}</dt>
+ <dd>Closes the channel object, indicating it won't get any new messages, and allowing it to be, eventually, garbage collected.</dd>
+</dl>
+
+<h2 id="Events">Events</h2>
+
+<dl>
+ <dt><code><a href="/en-US/docs/Web/API/BroadcastChannel/message_event">message</a></code></dt>
+ <dd>Fired when when a message arrives on the channel.<br>
+ Also available via the <code><a href="/en-US/docs/Web/API/BroadcastChannel/onmessage">onmessage</a></code> property.</dd>
+ <dt><code><a href="/en-US/docs/Web/API/BroadcastChannel/messageerror_event">messageerror</a></code></dt>
+ <dd>Fired when a message arrives that can't be deserialized.<br>
+ Also available via the <code><a href="/en-US/docs/Web/API/BroadcastChannel/onmessageerror">onmessageerror</a></code> property.</dd>
+</dl>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', "comms.html#broadcastchannel", "BroadcastChannel")}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.BroadcastChannel")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>Another, more heavyweight, way of communicating between browser contexts: {{domxref("ServiceWorker")}}.</li>
+ <li><a href="/en-US/docs/Web/API/Broadcast_Channel_API">Broadcast Channel API overview</a></li>
+</ul>