aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/broadcastchannel/postmessage/index.html
blob: 17ea5ad451e71c27cfb0ae97fd147fef89cde433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: BroadcastChannel.postMessage()
slug: Web/API/BroadcastChannel/postMessage
tags:
  - API
  - Broadcast Channel API
  - BroadcastChannel
  - HTML API
  - Определение
  - Экспериментальное
  - метод
translation_of: Web/API/BroadcastChannel/postMessage
---
<p>{{APIRef("BroadCastChannel API")}}</p>

<p><strong><code>BroadcastChannel.postMessage()</code></strong> отправляет сообщение, которое может быть любым {{jsxref("Object", "объектом")}}, каждому слушателю в {{glossary("browsing context", "контексте браузера")}} с тем же {{glossary("origin")}}. Сообщение передается в виде события {{event("message")}} к каждому <code>BroadcastChannel</code>, привязанному к данному каналу.</p>

<p>{{AvailableInWorkers}}</p>

<h2 id="Синтаксис">Синтаксис</h2>

<pre class="syntaxbox notranslate">var <em>str</em> = <em>channe<code>l</code></em><code>.postMessage(<em>object</em>);</code>
</pre>

<h2 id="Спецификации">Спецификации</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Спецификация</th>
   <th scope="col">Статус</th>
   <th scope="col">Комментарии</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', "comms.html#dom-broadcastchannel-postmessage", "BroadcastChannel.postmessage()")}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Совместимость">Совместимость</h2>



<p>{{Compat("api.BroadcastChannel.postMessage")}}</p>

<h2 id="См._также">См. также</h2>

<ul>
 <li>{{domxref("BroadcastChannel")}}, интерфейс, к которому относится <strong><code>postMessage</code></strong>.</li>
</ul>