aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/websocket/close_event
diff options
context:
space:
mode:
authorMDN <actions@users.noreply.github.com>2021-12-16 00:52:08 +0000
committerMDN <actions@users.noreply.github.com>2021-12-16 00:52:08 +0000
commit9b97f9f4a1f580cbf582fb4bebabbccaab8e5dda (patch)
tree513e8e35a07a3fd1dc45a5415425fd3780075d51 /files/zh-cn/web/api/websocket/close_event
parent7f7c1b96a524c16de813516cc1b7ed3b773ae7ad (diff)
downloadtranslated-content-9b97f9f4a1f580cbf582fb4bebabbccaab8e5dda.tar.gz
translated-content-9b97f9f4a1f580cbf582fb4bebabbccaab8e5dda.tar.bz2
translated-content-9b97f9f4a1f580cbf582fb4bebabbccaab8e5dda.zip
[CRON] sync translated content
Diffstat (limited to 'files/zh-cn/web/api/websocket/close_event')
-rw-r--r--files/zh-cn/web/api/websocket/close_event/index.html38
1 files changed, 38 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/websocket/close_event/index.html b/files/zh-cn/web/api/websocket/close_event/index.html
new file mode 100644
index 0000000000..b168dace44
--- /dev/null
+++ b/files/zh-cn/web/api/websocket/close_event/index.html
@@ -0,0 +1,38 @@
+---
+title: WebSocket.onclose
+slug: Web/API/WebSocket/close_event
+translation_of: Web/API/WebSocket/onclose
+original_slug: Web/API/WebSocket/onclose
+---
+<p>{{APIRef("Web Sockets API")}}</p>
+
+<p><strong><code>WebSocket.onclose</code></strong> 属性返回一个事件监听器,这个事件监听器将在 WebSocket 连接的{{domxref("WebSocket.readyState","readyState")}} 变为 <code>CLOSED</code>时被调用,它接收一个名字为“close”的 {{domxref("CloseEvent")}} 事件。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>WebSocket</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>