diff options
author | MDN <actions@users.noreply.github.com> | 2021-12-16 00:52:08 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2021-12-16 00:52:08 +0000 |
commit | 9b97f9f4a1f580cbf582fb4bebabbccaab8e5dda (patch) | |
tree | 513e8e35a07a3fd1dc45a5415425fd3780075d51 /files/zh-cn/conflicting/web | |
parent | 7f7c1b96a524c16de813516cc1b7ed3b773ae7ad (diff) | |
download | translated-content-9b97f9f4a1f580cbf582fb4bebabbccaab8e5dda.tar.gz translated-content-9b97f9f4a1f580cbf582fb4bebabbccaab8e5dda.tar.bz2 translated-content-9b97f9f4a1f580cbf582fb4bebabbccaab8e5dda.zip |
[CRON] sync translated content
Diffstat (limited to 'files/zh-cn/conflicting/web')
-rw-r--r-- | files/zh-cn/conflicting/web/api/websocket/error_event/index.html | 46 | ||||
-rw-r--r-- | files/zh-cn/conflicting/web/api/websocket/message_event/index.html | 50 |
2 files changed, 96 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/api/websocket/error_event/index.html b/files/zh-cn/conflicting/web/api/websocket/error_event/index.html new file mode 100644 index 0000000000..8cf8d972f4 --- /dev/null +++ b/files/zh-cn/conflicting/web/api/websocket/error_event/index.html @@ -0,0 +1,46 @@ +--- +title: WebSocket.onerror +slug: conflicting/Web/API/WebSocket/error_event +translation_of: Web/API/WebSocket/onerror +original_slug: 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/conflicting/web/api/websocket/message_event/index.html b/files/zh-cn/conflicting/web/api/websocket/message_event/index.html new file mode 100644 index 0000000000..ae8fa9c3bd --- /dev/null +++ b/files/zh-cn/conflicting/web/api/websocket/message_event/index.html @@ -0,0 +1,50 @@ +--- +title: WebSocket.onmessage +slug: conflicting/Web/API/WebSocket/message_event +tags: + - API + - Web API + - WebSocket + - 参考 + - 属性 +translation_of: Web/API/WebSocket/onmessage +original_slug: 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> |