From 4f4d511f3a78d7e3dc357e44481cf0a7eba99b9f Mon Sep 17 00:00:00 2001 From: MDN Date: Thu, 17 Mar 2022 00:12:44 +0000 Subject: [CRON] sync translated content --- files/zh-cn/_redirects.txt | 7 ++ files/zh-cn/_wikihistory.json | 84 +++++++++++----------- .../icecandidate_event/index.html | 66 +++++++++++++++++ .../conflicting/web/http/headers/cookie/index.html | 56 +++++++++++++++ .../web/http/headers/set-cookie/index.html | 71 ++++++++++++++++++ .../rtcpeerconnection/addstream_event/index.html | 54 ++++++++++++++ .../rtcpeerconnection/datachannel_event/index.html | 61 ++++++++++++++++ .../api/rtcpeerconnection/onaddstream/index.html | 53 -------------- .../api/rtcpeerconnection/ondatachannel/index.html | 60 ---------------- .../rtcpeerconnection/onicecandidate/index.html | 65 ----------------- .../web/api/rtcpeerconnection/ontrack/index.html | 56 --------------- .../api/rtcpeerconnection/track_event/index.html | 57 +++++++++++++++ .../web/api/serviceworker/onstatechange/index.html | 69 ------------------ .../api/serviceworker/statechange_event/index.html | 70 ++++++++++++++++++ files/zh-cn/web/http/headers/cookie2/index.html | 55 -------------- .../zh-cn/web/http/headers/set-cookie2/index.html | 70 ------------------ 16 files changed, 484 insertions(+), 470 deletions(-) create mode 100644 files/zh-cn/conflicting/web/api/rtcpeerconnection/icecandidate_event/index.html create mode 100644 files/zh-cn/conflicting/web/http/headers/cookie/index.html create mode 100644 files/zh-cn/conflicting/web/http/headers/set-cookie/index.html create mode 100644 files/zh-cn/web/api/rtcpeerconnection/addstream_event/index.html create mode 100644 files/zh-cn/web/api/rtcpeerconnection/datachannel_event/index.html delete mode 100644 files/zh-cn/web/api/rtcpeerconnection/onaddstream/index.html delete mode 100644 files/zh-cn/web/api/rtcpeerconnection/ondatachannel/index.html delete mode 100644 files/zh-cn/web/api/rtcpeerconnection/onicecandidate/index.html delete mode 100644 files/zh-cn/web/api/rtcpeerconnection/ontrack/index.html create mode 100644 files/zh-cn/web/api/rtcpeerconnection/track_event/index.html delete mode 100644 files/zh-cn/web/api/serviceworker/onstatechange/index.html create mode 100644 files/zh-cn/web/api/serviceworker/statechange_event/index.html delete mode 100644 files/zh-cn/web/http/headers/cookie2/index.html delete mode 100644 files/zh-cn/web/http/headers/set-cookie2/index.html (limited to 'files/zh-cn') diff --git a/files/zh-cn/_redirects.txt b/files/zh-cn/_redirects.txt index 3b9ee0afb5..aa184cbb38 100644 --- a/files/zh-cn/_redirects.txt +++ b/files/zh-cn/_redirects.txt @@ -1483,6 +1483,10 @@ /zh-CN/docs/Web/API/PositionOptions /zh-CN/docs/conflicting/Web/API/Geolocation/getCurrentPosition /zh-CN/docs/Web/API/PositionOptions/timeout /zh-CN/docs/conflicting/Web/API/Geolocation/getCurrentPosition_058087067b28ad25fff974fd59827fb6 /zh-CN/docs/Web/API/RTCConfiguration /zh-CN/docs/conflicting/Web/API/RTCPeerConnection/RTCPeerConnection +/zh-CN/docs/Web/API/RTCPeerConnection/onaddstream /zh-CN/docs/Web/API/RTCPeerConnection/addstream_event +/zh-CN/docs/Web/API/RTCPeerConnection/ondatachannel /zh-CN/docs/Web/API/RTCPeerConnection/datachannel_event +/zh-CN/docs/Web/API/RTCPeerConnection/onicecandidate /zh-CN/docs/conflicting/Web/API/RTCPeerConnection/icecandidate_event +/zh-CN/docs/Web/API/RTCPeerConnection/ontrack /zh-CN/docs/Web/API/RTCPeerConnection/track_event /zh-CN/docs/Web/API/RandomSource/getRandomValues /zh-CN/docs/Web/API/Crypto/getRandomValues /zh-CN/docs/Web/API/Response/克隆 /zh-CN/docs/Web/API/Response/clone /zh-CN/docs/Web/API/SVGPathElement/getTotalLength /zh-CN/docs/Web/API/SVGGeometryElement/getTotalLength @@ -1503,6 +1507,7 @@ /zh-CN/docs/Web/API/Selection.isCollapsed /zh-CN/docs/Web/API/Selection/isCollapsed /zh-CN/docs/Web/API/Selection.removeRange /zh-CN/docs/Web/API/Selection/removeRange /zh-CN/docs/Web/API/Selection/从Document中删除 /zh-CN/docs/Web/API/Selection/deleteFromDocument +/zh-CN/docs/Web/API/ServiceWorker/onstatechange /zh-CN/docs/Web/API/ServiceWorker/statechange_event /zh-CN/docs/Web/API/ServiceWorkerGlobalScope/caches /zh-CN/docs/conflicting/Web/API/caches /zh-CN/docs/Web/API/StorageEstimate /zh-CN/docs/conflicting/Web/API/StorageManager/estimate /zh-CN/docs/Web/API/Streams_API/使用可读文件流 /zh-CN/docs/Web/API/Streams_API/Using_readable_streams @@ -2048,6 +2053,8 @@ /zh-CN/docs/Web/HTTP/Headers/Content-Security-Policy__by_cnvoid/require-sri-for /zh-CN/docs/Web/HTTP/Headers/Content-Security-Policy/require-sri-for /zh-CN/docs/Web/HTTP/Headers/Content-Security-Policy__by_cnvoid/sandbox /zh-CN/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox /zh-CN/docs/Web/HTTP/Headers/Content-Security-Policy__by_cnvoid/upgrade-insecure-requests /zh-CN/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests +/zh-CN/docs/Web/HTTP/Headers/Cookie2 /zh-CN/docs/conflicting/Web/HTTP/Headers/Cookie +/zh-CN/docs/Web/HTTP/Headers/Set-Cookie2 /zh-CN/docs/conflicting/Web/HTTP/Headers/Set-Cookie /zh-CN/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_(PAC)_file /zh-CN/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file /zh-CN/docs/Web/HTTP/Response_codes /zh-CN/docs/Web/HTTP/Status /zh-CN/docs/Web/HTTP/Response_codes/100 /zh-CN/docs/Web/HTTP/Status/100 diff --git a/files/zh-cn/_wikihistory.json b/files/zh-cn/_wikihistory.json index 4dcfa7ff44..a748dafa8d 100644 --- a/files/zh-cn/_wikihistory.json +++ b/files/zh-cn/_wikihistory.json @@ -18720,6 +18720,12 @@ "Mr.Chenzm" ] }, + "Web/API/RTCPeerConnection/addstream_event": { + "modified": "2019-03-23T22:57:28.674Z", + "contributors": [ + "starsun" + ] + }, "Web/API/RTCPeerConnection/canTrickleIceCandidates": { "modified": "2020-10-15T22:17:37.803Z", "contributors": [ @@ -18752,6 +18758,12 @@ "SDUTWSL" ] }, + "Web/API/RTCPeerConnection/datachannel_event": { + "modified": "2019-03-23T22:21:43.126Z", + "contributors": [ + "physihan" + ] + }, "Web/API/RTCPeerConnection/getReceivers": { "modified": "2020-10-15T22:34:32.923Z", "contributors": [ @@ -18778,30 +18790,6 @@ "BillgoXu" ] }, - "Web/API/RTCPeerConnection/onaddstream": { - "modified": "2019-03-23T22:57:28.674Z", - "contributors": [ - "starsun" - ] - }, - "Web/API/RTCPeerConnection/ondatachannel": { - "modified": "2019-03-23T22:21:43.126Z", - "contributors": [ - "physihan" - ] - }, - "Web/API/RTCPeerConnection/onicecandidate": { - "modified": "2020-10-15T22:21:52.694Z", - "contributors": [ - "babaiwan" - ] - }, - "Web/API/RTCPeerConnection/ontrack": { - "modified": "2019-03-18T21:45:45.168Z", - "contributors": [ - "track_vovo" - ] - }, "Web/API/RTCPeerConnection/peerIdentity": { "modified": "2020-10-15T22:23:54.416Z", "contributors": [ @@ -18833,6 +18821,12 @@ "w05163" ] }, + "Web/API/RTCPeerConnection/track_event": { + "modified": "2019-03-18T21:45:45.168Z", + "contributors": [ + "track_vovo" + ] + }, "Web/API/RTCRtpTransceiver": { "modified": "2020-10-15T22:34:39.974Z", "contributors": [ @@ -19732,12 +19726,6 @@ "marsoln" ] }, - "Web/API/ServiceWorker/onstatechange": { - "modified": "2019-03-23T22:08:26.258Z", - "contributors": [ - "fanyer" - ] - }, "Web/API/ServiceWorker/scriptURL": { "modified": "2019-03-23T22:08:31.728Z", "contributors": [ @@ -19750,6 +19738,12 @@ "fanyer" ] }, + "Web/API/ServiceWorker/statechange_event": { + "modified": "2019-03-23T22:08:26.258Z", + "contributors": [ + "fanyer" + ] + }, "Web/API/ServiceWorkerContainer": { "modified": "2019-03-23T22:22:40.555Z", "contributors": [ @@ -33666,12 +33660,6 @@ "WayneCui" ] }, - "Web/HTTP/Headers/Cookie2": { - "modified": "2020-10-15T21:54:52.521Z", - "contributors": [ - "WayneCui" - ] - }, "Web/HTTP/Headers/Cross-Origin-Embedder-Policy": { "modified": "2020-10-15T22:33:37.678Z", "contributors": [ @@ -34006,12 +33994,6 @@ "tinaawang" ] }, - "Web/HTTP/Headers/Set-Cookie2": { - "modified": "2020-10-15T21:54:57.437Z", - "contributors": [ - "WayneCui" - ] - }, "Web/HTTP/Headers/SourceMap": { "modified": "2020-10-15T21:55:30.390Z", "contributors": [ @@ -47167,6 +47149,12 @@ "moshoujingli" ] }, + "conflicting/Web/API/RTCPeerConnection/icecandidate_event": { + "modified": "2020-10-15T22:21:52.694Z", + "contributors": [ + "babaiwan" + ] + }, "conflicting/Web/API/StorageManager/estimate": { "modified": "2019-03-18T21:31:04.064Z", "contributors": [ @@ -47610,6 +47598,18 @@ "ziyunfei" ] }, + "conflicting/Web/HTTP/Headers/Cookie": { + "modified": "2020-10-15T21:54:52.521Z", + "contributors": [ + "WayneCui" + ] + }, + "conflicting/Web/HTTP/Headers/Set-Cookie": { + "modified": "2020-10-15T21:54:57.437Z", + "contributors": [ + "WayneCui" + ] + }, "conflicting/Web/HTTP/Status": { "modified": "2019-01-16T13:20:30.376Z", "contributors": [ diff --git a/files/zh-cn/conflicting/web/api/rtcpeerconnection/icecandidate_event/index.html b/files/zh-cn/conflicting/web/api/rtcpeerconnection/icecandidate_event/index.html new file mode 100644 index 0000000000..8759f7aada --- /dev/null +++ b/files/zh-cn/conflicting/web/api/rtcpeerconnection/icecandidate_event/index.html @@ -0,0 +1,66 @@ +--- +title: RTCPeerConnection.onicecandidate +slug: conflicting/Web/API/RTCPeerConnection/icecandidate_event +translation_of: Web/API/RTCPeerConnection/onicecandidate +original_slug: Web/API/RTCPeerConnection/onicecandidate +--- +

{{APIRef("WebRTC")}}

+ +

 RTCPeerConnection 的属性 {{domxref("RTCPeerConnection.onicecandidate", "onicecandidate")}} (是一个事件触发器 {{event("Event_handlers", "event handler")}}) 能够让函数在事件{{event("icecandidate")}}发生在实例  {{domxref("RTCPeerConnection")}} 上时被调用。 只要本地代理{{Glossary("ICE")}} 需要通过信令服务器传递信息给其他对等端时就会触发 这让本地代理与其他对等体相协商而浏览器本身在使用时无需知道任何详细的有关信令技术的细节,只需要简单地应用这种方法就可使用您选择的任何消息传递技术将ICE候选发送到远程对等方。

+ +

Syntax

+ +
rtcPeerConnection.onicecandidate = eventHandler;
+
+ +

Value

+ +

这应该设置为您提供的函数,该函数接受RTCPeerConnectionIceEvent表示icecandidate事件对象作为输入该功能应该通过信令服务器将可以在事件属性中找到SDP的ICE候选者传递candidate给远程对等体。

+ +

如果事件的candidate属性是null,ICE收集已经完成。不应将此消息发送到远程对等方。发生这种情况时,连接iceGatheringState也已更改为complete你不需要明确地注意这一点; 相反,如果你需要感知信令的结束,你应该注意一个icegatheringstatechange事件,表明ICE协商已经转变为complete状态。

+ +

Example

+ +

下面的示例基于文章信令和视频调用中的代码,icecandidate事件设置处理程序,以便将候选项发送到远程对等方。

+ +
pc.onicecandidate = function(event) {
+  if (event.candidate) {
+    // Send the candidate to the remote peer
+  } else {
+    // All ICE candidates have been sent
+  }
+}
+ +

请注意,当检测到协议结束时{{domxref("RTCPeerConnectionIceEvent.candidate", "candidate")}} 属性为 null.

+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
WebRTC 1.0:浏览器之间的实时通信
+ 该规范中“RTCPeerConnection.onicecandidate”的定义。
{{ Spec2('WebRTC 1.0') }}Initial specification.
+ +

浏览器兼容性

+ + + +

{{Compat("api.RTCPeerConnection.onicecandidate")}}

+ +

See also

+ + diff --git a/files/zh-cn/conflicting/web/http/headers/cookie/index.html b/files/zh-cn/conflicting/web/http/headers/cookie/index.html new file mode 100644 index 0000000000..3b17451de1 --- /dev/null +++ b/files/zh-cn/conflicting/web/http/headers/cookie/index.html @@ -0,0 +1,56 @@ +--- +title: Cookie2 +slug: conflicting/Web/HTTP/Headers/Cookie +tags: + - 废弃 + - 请求首部 + - 首部 +translation_of: Web/HTTP/Headers/Cookie2 +original_slug: Web/HTTP/Headers/Cookie2 +--- +
{{HTTPSidebar}} {{obsolete_header}}
+ +

这个已经被废弃的 Cookie2 请求首部曾经被用来告知浏览器该用户代理支持“新型” cookies,但是现代的用户代理一般使用 {{HTTPHeader("Cookie")}} 来替代 Cookie2

+ + + + + + + + + + + + +
Header type{{Glossary("Request header")}}
{{Glossary("Forbidden header name")}}yes
+ +

示例

+ +
Cookie2: $Version="1"
+ +

规范

+ + + + + + + + + + + + +
SpecificationTitle
{{RFC("2965", "Cookie2")}}Historic specification of HTTP State Management Mechanism, obsoleted by {{RFC("6265")}}
+ +

浏览器兼容性

+ +

{{Compat("http.headers.Cookie2")}}

+ +

相关内容

+ + diff --git a/files/zh-cn/conflicting/web/http/headers/set-cookie/index.html b/files/zh-cn/conflicting/web/http/headers/set-cookie/index.html new file mode 100644 index 0000000000..eab79f915f --- /dev/null +++ b/files/zh-cn/conflicting/web/http/headers/set-cookie/index.html @@ -0,0 +1,71 @@ +--- +title: Set-Cookie2 +slug: conflicting/Web/HTTP/Headers/Set-Cookie +tags: + - 废止 + - 首部 +translation_of: Web/HTTP/Headers/Set-Cookie2 +original_slug: Web/HTTP/Headers/Set-Cookie2 +--- +
{{HTTPSidebar}} {{obsolete_header}}
+ +

Set-Cookie2 是一个响应首部,已废弃使用。它被服务器用来向客户端发送 cookie 数据,但是已经在协议中被标记为不赞成使用了。请使用 {{HTTPHeader("Set-Cookie")}}  将其代替。

+ + + + + + + + + + + + +
Header type{{Glossary("Response header")}}
{{Glossary("Forbidden header name")}}no
+ +

语法

+ +
Set-Cookie2: <cookie-name>=<cookie-value>
+Set-Cookie2: <cookie-name>=<cookie-value>; Comment=<value>
+Set-Cookie2: <cookie-name>=<cookie-value>; CommentURL=<http-url>
+Set-Cookie2: <cookie-name>=<cookie-value>; Discard
+Set-Cookie2: <cookie-name>=<cookie-value>; Domain=<domain-value>
+Set-Cookie2: <cookie-name>=<cookie-value>; Max-Age=<non-zero-digit>
+Set-Cookie2: <cookie-name>=<cookie-value>; Path=<path-value>
+Set-Cookie2: <cookie-name>=<cookie-value>; Port=<port-number>
+Set-Cookie2: <cookie-name>=<cookie-value>; Secure
+Set-Cookie2: <cookie-name>=<cookie-value>; Version=<version-number>
+
+// Multiple directives are also possible, for example:
+Set-Cookie2: <cookie-name>=<cookie-value>; Domain=<domain-value>; Secure
+
+// Multiple cookies are seperated by a comma
+Set-Cookie2: <cookie-name>=<cookie-value>, <cookie-name>=<cookie-value>, ...
+
+ +

规范

+ + + + + + + + + + + + +
SpecificationTitle
{{RFC("2965", "Set-Cookie2")}}Historic specification of HTTP State Management Mechanism, obsoleted by {{RFC("6265")}}
+ +

浏览器兼容性

+ +

{{Compat("http.headers.Set-Cookie2")}}

+ +

相关内容

+ + diff --git a/files/zh-cn/web/api/rtcpeerconnection/addstream_event/index.html b/files/zh-cn/web/api/rtcpeerconnection/addstream_event/index.html new file mode 100644 index 0000000000..25483657c8 --- /dev/null +++ b/files/zh-cn/web/api/rtcpeerconnection/addstream_event/index.html @@ -0,0 +1,54 @@ +--- +title: RTCPeerConnection.onaddstream +slug: Web/API/RTCPeerConnection/addstream_event +translation_of: Web/API/RTCPeerConnection/onaddstream +original_slug: Web/API/RTCPeerConnection/onaddstream +--- +

{{APIRef("WebRTC")}}{{SeeCompatTable}}

+ +

当类型为{{domxref("MediaStreamEvent")}}的{{event("addstream")}} 事件发生时,通过{{domxref("RTCPeerConnection")}}触发RTCPeerConnection.onaddstream 事件处理函数。当远程媒体流{{domxref("MediaStream")}} 添加到连接后发送事件。当{{domxref("RTCPeerConnection.setRemoteDescription()")}} 后此事件立即被调用而不需要等待SDP交换完成。

+ +

语法

+ +
peerconnection.onaddstream = function;
+
+ +

+ + + +

例子

+ +
pc.onaddstream = function(ev) { alert("onaddstream event detected!"); };
+
+ +

规范

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{ SpecName('WebRTC 1.0', '#widl-RTCPeerConnection-onaddstream', 'RTCPeerConnection.onaddstream') }}{{ Spec2('WebRTC 1.0') }}Initial specification.
+ +

浏览器兼容性

+ +{{Compat("api.RTCPeerConnection.onaddstream")}} + +

扩展阅读

+ + diff --git a/files/zh-cn/web/api/rtcpeerconnection/datachannel_event/index.html b/files/zh-cn/web/api/rtcpeerconnection/datachannel_event/index.html new file mode 100644 index 0000000000..921f9a0449 --- /dev/null +++ b/files/zh-cn/web/api/rtcpeerconnection/datachannel_event/index.html @@ -0,0 +1,61 @@ +--- +title: RTCPeerConnection.ondatachannel +slug: Web/API/RTCPeerConnection/datachannel_event +translation_of: Web/API/RTCPeerConnection/ondatachannel +original_slug: Web/API/RTCPeerConnection/ondatachannel +--- +

{{APIRef("WebRTC")}}{{SeeCompatTable}}

+ +

RTCPeerConnection.ondatachannel 属性是一个{{event("Event_handlers", "event handler")}},当这个{{event("datachannel")}}事件在{{domxref("RTCPeerConnection")}}发生时,它指定的那个事件处理函数就会被调用。这个事件继承于 {{domxref("RTCDataChannelEvent")}},当远方伙伴调用{{domxref("RTCPeerConnection.createDataChannel", "createDataChannel()")}}时这个事件被加到这个连接(RTCPeerConnection)中。

+ +

在这个事件被收到的同时,这个{{domxref("RTCDataChannel")}} 实际上并没有打开,确保在open这个事件在RTCDataChannel触发以后才去使用它。

+ +

语法

+ +
RTCPeerConnection.ondatachannel = function;
+
+ +

+ +

将这个属性设置为接受一个参数的函数:这个参数是一个{{domxref("RTCDataChannelEvent")}},它的channel属性是一个已经创建了的{{domxref("RTCDataChannel")}}对象

+ +

示例

+ +
pc.ondatachannel = function(ev) {
+  console.log('Data channel is created!');
+  ev.channel.onopen = function() {
+    console.log('Data channel is open and ready to be used.');
+  };
+};
+
+ +

规范

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{ SpecName('WebRTC 1.0', '#dom-rtcpeerconnection-ondatachannel', 'RTCPeerConnection.ondatachannel') }}{{ Spec2('WebRTC 1.0') }}Initial specification.
+ +

浏览器支持

+ +{{Compat("api.RTCPeerConnection.ondatachannel")}} + +

相关阅读

+ + diff --git a/files/zh-cn/web/api/rtcpeerconnection/onaddstream/index.html b/files/zh-cn/web/api/rtcpeerconnection/onaddstream/index.html deleted file mode 100644 index a61e2f28c6..0000000000 --- a/files/zh-cn/web/api/rtcpeerconnection/onaddstream/index.html +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: RTCPeerConnection.onaddstream -slug: Web/API/RTCPeerConnection/onaddstream -translation_of: Web/API/RTCPeerConnection/onaddstream ---- -

{{APIRef("WebRTC")}}{{SeeCompatTable}}

- -

当类型为{{domxref("MediaStreamEvent")}}的{{event("addstream")}} 事件发生时,通过{{domxref("RTCPeerConnection")}}触发RTCPeerConnection.onaddstream 事件处理函数。当远程媒体流{{domxref("MediaStream")}} 添加到连接后发送事件。当{{domxref("RTCPeerConnection.setRemoteDescription()")}} 后此事件立即被调用而不需要等待SDP交换完成。

- -

语法

- -
peerconnection.onaddstream = function;
-
- -

- - - -

例子

- -
pc.onaddstream = function(ev) { alert("onaddstream event detected!"); };
-
- -

规范

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{ SpecName('WebRTC 1.0', '#widl-RTCPeerConnection-onaddstream', 'RTCPeerConnection.onaddstream') }}{{ Spec2('WebRTC 1.0') }}Initial specification.
- -

浏览器兼容性

- -{{Compat("api.RTCPeerConnection.onaddstream")}} - -

扩展阅读

- - diff --git a/files/zh-cn/web/api/rtcpeerconnection/ondatachannel/index.html b/files/zh-cn/web/api/rtcpeerconnection/ondatachannel/index.html deleted file mode 100644 index 73b9b136ed..0000000000 --- a/files/zh-cn/web/api/rtcpeerconnection/ondatachannel/index.html +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: RTCPeerConnection.ondatachannel -slug: Web/API/RTCPeerConnection/ondatachannel -translation_of: Web/API/RTCPeerConnection/ondatachannel ---- -

{{APIRef("WebRTC")}}{{SeeCompatTable}}

- -

RTCPeerConnection.ondatachannel 属性是一个{{event("Event_handlers", "event handler")}},当这个{{event("datachannel")}}事件在{{domxref("RTCPeerConnection")}}发生时,它指定的那个事件处理函数就会被调用。这个事件继承于 {{domxref("RTCDataChannelEvent")}},当远方伙伴调用{{domxref("RTCPeerConnection.createDataChannel", "createDataChannel()")}}时这个事件被加到这个连接(RTCPeerConnection)中。

- -

在这个事件被收到的同时,这个{{domxref("RTCDataChannel")}} 实际上并没有打开,确保在open这个事件在RTCDataChannel触发以后才去使用它。

- -

语法

- -
RTCPeerConnection.ondatachannel = function;
-
- -

- -

将这个属性设置为接受一个参数的函数:这个参数是一个{{domxref("RTCDataChannelEvent")}},它的channel属性是一个已经创建了的{{domxref("RTCDataChannel")}}对象

- -

示例

- -
pc.ondatachannel = function(ev) {
-  console.log('Data channel is created!');
-  ev.channel.onopen = function() {
-    console.log('Data channel is open and ready to be used.');
-  };
-};
-
- -

规范

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
{{ SpecName('WebRTC 1.0', '#dom-rtcpeerconnection-ondatachannel', 'RTCPeerConnection.ondatachannel') }}{{ Spec2('WebRTC 1.0') }}Initial specification.
- -

浏览器支持

- -{{Compat("api.RTCPeerConnection.ondatachannel")}} - -

相关阅读

- - diff --git a/files/zh-cn/web/api/rtcpeerconnection/onicecandidate/index.html b/files/zh-cn/web/api/rtcpeerconnection/onicecandidate/index.html deleted file mode 100644 index a0efcfed3a..0000000000 --- a/files/zh-cn/web/api/rtcpeerconnection/onicecandidate/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: RTCPeerConnection.onicecandidate -slug: Web/API/RTCPeerConnection/onicecandidate -translation_of: Web/API/RTCPeerConnection/onicecandidate ---- -

{{APIRef("WebRTC")}}

- -

 RTCPeerConnection 的属性 {{domxref("RTCPeerConnection.onicecandidate", "onicecandidate")}} (是一个事件触发器 {{event("Event_handlers", "event handler")}}) 能够让函数在事件{{event("icecandidate")}}发生在实例  {{domxref("RTCPeerConnection")}} 上时被调用。 只要本地代理{{Glossary("ICE")}} 需要通过信令服务器传递信息给其他对等端时就会触发 这让本地代理与其他对等体相协商而浏览器本身在使用时无需知道任何详细的有关信令技术的细节,只需要简单地应用这种方法就可使用您选择的任何消息传递技术将ICE候选发送到远程对等方。

- -

Syntax

- -
rtcPeerConnection.onicecandidate = eventHandler;
-
- -

Value

- -

这应该设置为您提供的函数,该函数接受RTCPeerConnectionIceEvent表示icecandidate事件对象作为输入该功能应该通过信令服务器将可以在事件属性中找到SDP的ICE候选者传递candidate给远程对等体。

- -

如果事件的candidate属性是null,ICE收集已经完成。不应将此消息发送到远程对等方。发生这种情况时,连接iceGatheringState也已更改为complete你不需要明确地注意这一点; 相反,如果你需要感知信令的结束,你应该注意一个icegatheringstatechange事件,表明ICE协商已经转变为complete状态。

- -

Example

- -

下面的示例基于文章信令和视频调用中的代码,icecandidate事件设置处理程序,以便将候选项发送到远程对等方。

- -
pc.onicecandidate = function(event) {
-  if (event.candidate) {
-    // Send the candidate to the remote peer
-  } else {
-    // All ICE candidates have been sent
-  }
-}
- -

请注意,当检测到协议结束时{{domxref("RTCPeerConnectionIceEvent.candidate", "candidate")}} 属性为 null.

- -

Specifications

- - - - - - - - - - - - - - - - -
SpecificationStatusComment
WebRTC 1.0:浏览器之间的实时通信
- 该规范中“RTCPeerConnection.onicecandidate”的定义。
{{ Spec2('WebRTC 1.0') }}Initial specification.
- -

浏览器兼容性

- - - -

{{Compat("api.RTCPeerConnection.onicecandidate")}}

- -

See also

- - diff --git a/files/zh-cn/web/api/rtcpeerconnection/ontrack/index.html b/files/zh-cn/web/api/rtcpeerconnection/ontrack/index.html deleted file mode 100644 index 84c2b49cfe..0000000000 --- a/files/zh-cn/web/api/rtcpeerconnection/ontrack/index.html +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: RTCPeerConnection.ontrack -slug: Web/API/RTCPeerConnection/ontrack -translation_of: Web/API/RTCPeerConnection/ontrack ---- -

{{APIRef("WebRTC")}}{{SeeCompatTable}}RTCPeerConnection.ontrack 属性是一个 {{event("Event_handlers", "event handler")}} 此属性指定了在{{domxref("RTCPeerConnection")}}接口上触发 {{event("track")}} 事件时调用的方法。该方法接收一个{{domxref("RTCTrackEvent")}}类型的event对象,该event对象将在{{domxref("MediaStreamTrack")}}被创建时或者是关联到已被添加到接收集合的{{domxref("RTCRtpReceiver")}}对象中时被发送。

- -

语法

- -
RTCPeerConnection.ontrack = eventHandler;
-
- -

参数

- -

ontrack设置为你提供的一个输入{{domxref("RTCTrackEvent")}}对象用于描述新的track将如何使用的方法。这一信息包含了代表新track的{{domxref("MediaStreamTrack")}}对象、{{domxref("RTCRtpReceiver")}}对象、{{domxref("RTCRtpTransceiver")}}对象以及一个{{domxref("MediaStream")}}对象列表,该对象列表表示该track是那个媒体流的一部分。

- -

示例

- -

本示例,从这篇文章的代码和视频调用的代码中,将传入的轨迹连接到将用于显示传入{{HTMLElement("video")}}元素。

- -
pc.ontrack = function(event) {
-  document.getElementById("received_video").srcObject = event.streams[0];
-  document.getElementById("hangup-button").disabled = false;
-};
-
- -

在第一行代码中,我们的ontrack 事件处理器获取传入的第媒体流数组中的第一个,并赋值给video元素的{{htmlattrxref("srcObject", "video")}} 。这样媒体流就和页面中的video元素结合起来以便于呈现给用户。第二行代码简单启用了“挂断”按钮,用户可以使用它去断开呼叫。

- -

说明

- - - - - - - - - - - - - - - - -
说明状态注释
{{SpecName('WebRTC 1.0', '#widl-RTCPeerConnection-ontrack', 'RTCPeerConnection.ontrack')}}{{Spec2('WebRTC 1.0')}}初始规范
- -

各浏览器兼容性

- -{{Compat("api.RTCPeerConnection.ontrack")}} - -

参见

- - diff --git a/files/zh-cn/web/api/rtcpeerconnection/track_event/index.html b/files/zh-cn/web/api/rtcpeerconnection/track_event/index.html new file mode 100644 index 0000000000..0d121a93b6 --- /dev/null +++ b/files/zh-cn/web/api/rtcpeerconnection/track_event/index.html @@ -0,0 +1,57 @@ +--- +title: RTCPeerConnection.ontrack +slug: Web/API/RTCPeerConnection/track_event +translation_of: Web/API/RTCPeerConnection/ontrack +original_slug: Web/API/RTCPeerConnection/ontrack +--- +

{{APIRef("WebRTC")}}{{SeeCompatTable}}RTCPeerConnection.ontrack 属性是一个 {{event("Event_handlers", "event handler")}} 此属性指定了在{{domxref("RTCPeerConnection")}}接口上触发 {{event("track")}} 事件时调用的方法。该方法接收一个{{domxref("RTCTrackEvent")}}类型的event对象,该event对象将在{{domxref("MediaStreamTrack")}}被创建时或者是关联到已被添加到接收集合的{{domxref("RTCRtpReceiver")}}对象中时被发送。

+ +

语法

+ +
RTCPeerConnection.ontrack = eventHandler;
+
+ +

参数

+ +

ontrack设置为你提供的一个输入{{domxref("RTCTrackEvent")}}对象用于描述新的track将如何使用的方法。这一信息包含了代表新track的{{domxref("MediaStreamTrack")}}对象、{{domxref("RTCRtpReceiver")}}对象、{{domxref("RTCRtpTransceiver")}}对象以及一个{{domxref("MediaStream")}}对象列表,该对象列表表示该track是那个媒体流的一部分。

+ +

示例

+ +

本示例,从这篇文章的代码和视频调用的代码中,将传入的轨迹连接到将用于显示传入{{HTMLElement("video")}}元素。

+ +
pc.ontrack = function(event) {
+  document.getElementById("received_video").srcObject = event.streams[0];
+  document.getElementById("hangup-button").disabled = false;
+};
+
+ +

在第一行代码中,我们的ontrack 事件处理器获取传入的第媒体流数组中的第一个,并赋值给video元素的{{htmlattrxref("srcObject", "video")}} 。这样媒体流就和页面中的video元素结合起来以便于呈现给用户。第二行代码简单启用了“挂断”按钮,用户可以使用它去断开呼叫。

+ +

说明

+ + + + + + + + + + + + + + + + +
说明状态注释
{{SpecName('WebRTC 1.0', '#widl-RTCPeerConnection-ontrack', 'RTCPeerConnection.ontrack')}}{{Spec2('WebRTC 1.0')}}初始规范
+ +

各浏览器兼容性

+ +{{Compat("api.RTCPeerConnection.ontrack")}} + +

参见

+ + diff --git a/files/zh-cn/web/api/serviceworker/onstatechange/index.html b/files/zh-cn/web/api/serviceworker/onstatechange/index.html deleted file mode 100644 index 94807435b2..0000000000 --- a/files/zh-cn/web/api/serviceworker/onstatechange/index.html +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: ServiceWorker.onstatechange -slug: Web/API/ServiceWorker/onstatechange -translation_of: Web/API/ServiceWorker/onstatechange ---- -
{{SeeCompatTable}}{{APIRef("Service Workers API")}}
- -

一个 {{domxref("EventListener")}} 联动的属性,其会被任何stagechange类型事件抛出时联动; 它也基本上能在任何时候{{domxref("ServiceWorker.state")}} 改变时被抛出.

- -

语法

- -
ServiceWorker.onstatechange = function(statechangeevent) { ... }
-ServiceWorker.addEventListener('statechange', function(statechangeevent) { ... } )
- -

示例

- -

这段代码出自 service worker registration-events sample (live demo). 它会监听 {{domxref("ServiceWorker.state")}} 的改变并返回它的值.

- -
var serviceWorker;
-if (registration.installing) {
-  serviceWorker = registration.installing;
-  document.querySelector('#kind').textContent = 'installing';
-} else if (registration.waiting) {
-  serviceWorker = registration.waiting;
-  document.querySelector('#kind').textContent = 'waiting';
-} else if (registration.active) {
-  serviceWorker = registration.active;
-  document.querySelector('#kind').textContent = 'active';
-}
-
-if (serviceWorker) {
-  logState(serviceWorker.state);
-  serviceWorker.addEventListener('statechange', function(e) {
-  logState(e.target.state);
-  });
-}
- -

注意当statechange 抛出时, service worker的引用可能已经改变。例如:

- -
navigator.serviceWorker.register(..).then(function(swr) {
-  swr.installing.state == "installing"
-  swr.installing.onstatechange = function() {
-    swr.installing == null;
-    // At this point, swr.waiting OR swr.active might be true. This is because the statechange
-    // event gets queued, meanwhile the underlying worker may have gone into the waiting
-    // state and will be immediately activated if possible.
-  }
-})
- -

规范

- - - - - - - - - - - - - - -
规范状态附注
{{SpecName('Service Workers', '#service-worker-onstatechange-attribute', 'ServiceWorker.onstatechange')}}{{Spec2('Service Workers')}}Initial definition
- -

浏览器兼容性

- -{{Compat("api.ServiceWorker.onstatechange")}} diff --git a/files/zh-cn/web/api/serviceworker/statechange_event/index.html b/files/zh-cn/web/api/serviceworker/statechange_event/index.html new file mode 100644 index 0000000000..c14f156198 --- /dev/null +++ b/files/zh-cn/web/api/serviceworker/statechange_event/index.html @@ -0,0 +1,70 @@ +--- +title: ServiceWorker.onstatechange +slug: Web/API/ServiceWorker/statechange_event +translation_of: Web/API/ServiceWorker/onstatechange +original_slug: Web/API/ServiceWorker/onstatechange +--- +
{{SeeCompatTable}}{{APIRef("Service Workers API")}}
+ +

一个 {{domxref("EventListener")}} 联动的属性,其会被任何stagechange类型事件抛出时联动; 它也基本上能在任何时候{{domxref("ServiceWorker.state")}} 改变时被抛出.

+ +

语法

+ +
ServiceWorker.onstatechange = function(statechangeevent) { ... }
+ServiceWorker.addEventListener('statechange', function(statechangeevent) { ... } )
+ +

示例

+ +

这段代码出自 service worker registration-events sample (live demo). 它会监听 {{domxref("ServiceWorker.state")}} 的改变并返回它的值.

+ +
var serviceWorker;
+if (registration.installing) {
+  serviceWorker = registration.installing;
+  document.querySelector('#kind').textContent = 'installing';
+} else if (registration.waiting) {
+  serviceWorker = registration.waiting;
+  document.querySelector('#kind').textContent = 'waiting';
+} else if (registration.active) {
+  serviceWorker = registration.active;
+  document.querySelector('#kind').textContent = 'active';
+}
+
+if (serviceWorker) {
+  logState(serviceWorker.state);
+  serviceWorker.addEventListener('statechange', function(e) {
+  logState(e.target.state);
+  });
+}
+ +

注意当statechange 抛出时, service worker的引用可能已经改变。例如:

+ +
navigator.serviceWorker.register(..).then(function(swr) {
+  swr.installing.state == "installing"
+  swr.installing.onstatechange = function() {
+    swr.installing == null;
+    // At this point, swr.waiting OR swr.active might be true. This is because the statechange
+    // event gets queued, meanwhile the underlying worker may have gone into the waiting
+    // state and will be immediately activated if possible.
+  }
+})
+ +

规范

+ + + + + + + + + + + + + + +
规范状态附注
{{SpecName('Service Workers', '#service-worker-onstatechange-attribute', 'ServiceWorker.onstatechange')}}{{Spec2('Service Workers')}}Initial definition
+ +

浏览器兼容性

+ +{{Compat("api.ServiceWorker.onstatechange")}} diff --git a/files/zh-cn/web/http/headers/cookie2/index.html b/files/zh-cn/web/http/headers/cookie2/index.html deleted file mode 100644 index 24699b5103..0000000000 --- a/files/zh-cn/web/http/headers/cookie2/index.html +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: Cookie2 -slug: Web/HTTP/Headers/Cookie2 -tags: - - 废弃 - - 请求首部 - - 首部 -translation_of: Web/HTTP/Headers/Cookie2 ---- -
{{HTTPSidebar}} {{obsolete_header}}
- -

这个已经被废弃的 Cookie2 请求首部曾经被用来告知浏览器该用户代理支持“新型” cookies,但是现代的用户代理一般使用 {{HTTPHeader("Cookie")}} 来替代 Cookie2

- - - - - - - - - - - - -
Header type{{Glossary("Request header")}}
{{Glossary("Forbidden header name")}}yes
- -

示例

- -
Cookie2: $Version="1"
- -

规范

- - - - - - - - - - - - -
SpecificationTitle
{{RFC("2965", "Cookie2")}}Historic specification of HTTP State Management Mechanism, obsoleted by {{RFC("6265")}}
- -

浏览器兼容性

- -

{{Compat("http.headers.Cookie2")}}

- -

相关内容

- - diff --git a/files/zh-cn/web/http/headers/set-cookie2/index.html b/files/zh-cn/web/http/headers/set-cookie2/index.html deleted file mode 100644 index 117497bd4b..0000000000 --- a/files/zh-cn/web/http/headers/set-cookie2/index.html +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: Set-Cookie2 -slug: Web/HTTP/Headers/Set-Cookie2 -tags: - - 废止 - - 首部 -translation_of: Web/HTTP/Headers/Set-Cookie2 ---- -
{{HTTPSidebar}} {{obsolete_header}}
- -

Set-Cookie2 是一个响应首部,已废弃使用。它被服务器用来向客户端发送 cookie 数据,但是已经在协议中被标记为不赞成使用了。请使用 {{HTTPHeader("Set-Cookie")}}  将其代替。

- - - - - - - - - - - - -
Header type{{Glossary("Response header")}}
{{Glossary("Forbidden header name")}}no
- -

语法

- -
Set-Cookie2: <cookie-name>=<cookie-value>
-Set-Cookie2: <cookie-name>=<cookie-value>; Comment=<value>
-Set-Cookie2: <cookie-name>=<cookie-value>; CommentURL=<http-url>
-Set-Cookie2: <cookie-name>=<cookie-value>; Discard
-Set-Cookie2: <cookie-name>=<cookie-value>; Domain=<domain-value>
-Set-Cookie2: <cookie-name>=<cookie-value>; Max-Age=<non-zero-digit>
-Set-Cookie2: <cookie-name>=<cookie-value>; Path=<path-value>
-Set-Cookie2: <cookie-name>=<cookie-value>; Port=<port-number>
-Set-Cookie2: <cookie-name>=<cookie-value>; Secure
-Set-Cookie2: <cookie-name>=<cookie-value>; Version=<version-number>
-
-// Multiple directives are also possible, for example:
-Set-Cookie2: <cookie-name>=<cookie-value>; Domain=<domain-value>; Secure
-
-// Multiple cookies are seperated by a comma
-Set-Cookie2: <cookie-name>=<cookie-value>, <cookie-name>=<cookie-value>, ...
-
- -

规范

- - - - - - - - - - - - -
SpecificationTitle
{{RFC("2965", "Set-Cookie2")}}Historic specification of HTTP State Management Mechanism, obsoleted by {{RFC("6265")}}
- -

浏览器兼容性

- -

{{Compat("http.headers.Set-Cookie2")}}

- -

相关内容

- - -- cgit v1.2.3-54-g00ecf