blob: 4e029f4167614167317357deb61f62b34fdeb070 (
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
|
---
title: WebSocket.onclose
slug: Web/API/WebSocket/onclose
translation_of: Web/API/WebSocket/onclose
---
<p>{{APIRef("Web Sockets API")}}</p>
<p><code><strong>WebSocket.onclose</strong></code> プロパティは、WebSocket コネクションの {{domxref("WebSocket.readyState","readyState")}} が {{domxref("WebSocket.readyState","CLOSED")}} に変わったときに呼ばれる {{event("Event_handlers", "event handler")}} です。{{domxref("CloseEvent")}} と一緒に呼び出されます。</p>
<h2 id="構文">構文</h2>
<pre class="syntaxbox notranslate"><em>aWebSocket</em>.onclose = function(event) {
console.log("WebSocket is closed now.");
};</pre>
<h2 id="値">値</h2>
<p>{{domxref("EventListener")}}.</p>
<h2 id="仕様書">仕様書</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', '#handler-websocket-onclose', 'WebSocket: onclose')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
|