diff options
Diffstat (limited to 'files/zh-cn/web')
-rw-r--r-- | files/zh-cn/web/api/websocket/close_event/index.html (renamed from files/zh-cn/web/api/websocket/onclose/index.html) | 3 | ||||
-rw-r--r-- | files/zh-cn/web/api/websocket/onerror/index.html | 45 | ||||
-rw-r--r-- | files/zh-cn/web/api/websocket/onmessage/index.html | 49 | ||||
-rw-r--r-- | files/zh-cn/web/api/websocket/open_event/index.html (renamed from files/zh-cn/web/api/websocket/onopen/index.html) | 3 |
4 files changed, 4 insertions, 96 deletions
diff --git a/files/zh-cn/web/api/websocket/onclose/index.html b/files/zh-cn/web/api/websocket/close_event/index.html index 0ed1b7ffe1..b168dace44 100644 --- a/files/zh-cn/web/api/websocket/onclose/index.html +++ b/files/zh-cn/web/api/websocket/close_event/index.html @@ -1,7 +1,8 @@ --- title: WebSocket.onclose -slug: Web/API/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> diff --git a/files/zh-cn/web/api/websocket/onerror/index.html b/files/zh-cn/web/api/websocket/onerror/index.html deleted file mode 100644 index 996ad55472..0000000000 --- a/files/zh-cn/web/api/websocket/onerror/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: WebSocket.onerror -slug: Web/API/WebSocket/onerror -translation_of: Web/API/WebSocket/onerror ---- -<p>{{APIRef("Web Sockets API")}}</p> - -<p>The <strong><code>WebSocket.onerror</code></strong> property returns the event listener to be called when an error occurs. This is a simple event named "error".</p> - -<p>在 <strong><code>WebSocket.onerror </code></strong>属性中,你可以定义一个发生错误时执行的回调函数,此事件的事件名为"error"</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><em>WebSocket</em>.onerror = function(event) { - console.error("WebSocket error observed:", event); -};</pre> - -<h2 id="值">值</h2> - -<p>An {{domxref("EventListener")}}.</p> - -<h2 id="Specifications">Specifications</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-onerror', 'WebSocket: onerror')}}</td> - <td>{{Spec2('HTML WHATWG')}}</td> - <td>Initial definition</td> - </tr> - </tbody> -</table> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - - - -<p>{{Compat("api.WebSocket.onerror")}}</p> diff --git a/files/zh-cn/web/api/websocket/onmessage/index.html b/files/zh-cn/web/api/websocket/onmessage/index.html deleted file mode 100644 index 4bdcb51039..0000000000 --- a/files/zh-cn/web/api/websocket/onmessage/index.html +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: WebSocket.onmessage -slug: Web/API/WebSocket/onmessage -tags: - - API - - Web API - - WebSocket - - 参考 - - 属性 -translation_of: Web/API/WebSocket/onmessage ---- -<p>{{APIRef("Web Sockets API")}}</p> - -<p><code><strong>WebSocket.onmessage</strong></code> 属性是一个当收到来自服务器的消息时被调用的 {{event("Event_handlers", "event handler")}}。它由一个{{domxref("MessageEvent")}}调用。</p> - -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><em>aWebSocket</em>.onmessage = function(event) { - console.debug("WebSocket message received:", event); -};</pre> - -<h2 id="值">值</h2> - -<p>一个 {{domxref("EventListener")}}.</p> - -<h2 id="规范">规范</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">规范</th> - <th scope="col">状态</th> - <th scope="col">注释</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('HTML WHATWG', '#handler-websocket-onmessage', 'WebSocket: onmessage')}}</td> - <td>{{Spec2('HTML WHATWG')}}</td> - <td>初始定义</td> - </tr> - </tbody> -</table> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - - - -<p>{{Compat("api.WebSocket.onmessage")}}</p> diff --git a/files/zh-cn/web/api/websocket/onopen/index.html b/files/zh-cn/web/api/websocket/open_event/index.html index 067c9057bc..a0d5e78dc7 100644 --- a/files/zh-cn/web/api/websocket/onopen/index.html +++ b/files/zh-cn/web/api/websocket/open_event/index.html @@ -1,7 +1,8 @@ --- title: WebSocket.onopen -slug: Web/API/WebSocket/onopen +slug: Web/API/WebSocket/open_event translation_of: Web/API/WebSocket/onopen +original_slug: Web/API/WebSocket/onopen --- <p><strong><code>WebSocket.onopen</code></strong>属性定义一个事件处理程序,当{{domxref("WebSocket")}} 的连接状态{{domxref("WebSocket.readyState","readyState")}} 变为{{domxref("WebSocket.readyState","1")}}时调用;这意味着当前连接已经准备好发送和接受数据。这个事件处理程序通过 {{domxref("事件")}}(建立连接时)触发。</p> |