aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/broadcastchannel/messageerror_event/index.html
blob: 45c4c9385c978a91207a45960579042592523088 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: 'BroadcastChannel: messageerror イベント'
slug: Web/API/BroadcastChannel/messageerror_event
tags:
  - Event
translation_of: Web/API/BroadcastChannel/messageerror_event
---
<div>{{APIRef}}</div>

<p><span class="seoSummary"><code>messageerror</code> イベントは、逆シリアル化できないメッセージがチャネルに到着したときに {{domxref('BroadcastChannel')}} オブジェクトに対して発生します。</span></p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">バブリング</th>
   <td>なし</td>
  </tr>
  <tr>
   <th scope="row">キャンセル</th>
   <td>不可</td>
  </tr>
  <tr>
   <th scope="row">インターフェイス</th>
   <td>{{domxref("MessageEvent")}}</td>
  </tr>
  <tr>
   <th scope="row">イベントハンドラプロパティ</th>
   <td>{{domxref("BroadcastChannel.onmessageerror","onmessageerror")}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Examples" name="Examples"></h2>

<p>このコードは <code><a href="/ja/docs/Web/API/EventTarget/addEventListener">addEventListener</a></code> を使用してメッセージとエラーをリッスンします。</p>

<pre class="brush: js">const channel = new BroadcastChannel('example-channel');

channel.addEventListener('message', (event) =&gt; {
  received.textContent = event.data;
});

channel.addEventListener('messageerror', (event) =&gt; {
  console.error(event);
});</pre>

<p>上と同じですが、{{domxref("BroadcastChannel.onmessage","onmessage")}}{{domxref("BroadcastChannel.onmessageerror","onmessageerror")}} のイベントハンドラプロパティを使用します。</p>

<pre class="brush: js">const channel = new BroadcastChannel('example-channel');

channel.onmessage = (event) =&gt; {
  received.textContent = event.data;
};

channel.onmessageerror = (event) =&gt; {
  console.log(event);
};
</pre>

<h2 id="Specifications" name="Specifications">仕様</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">仕様</th>
   <th scope="col">状態</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'indices.html#event-messageerror')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>



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

<h2 id='See_also""' name='See_also""'>関連情報</h2>

<ul>
 <li>関連イベント: {{domxref("BroadcastChannel.message_event","message")}}</li>
</ul>