From cad23444a9ff3f3a3f2959c171155cafa91ef57b Mon Sep 17 00:00:00 2001 From: MDN Web Docs GitHub Bot <108879845+mdn-bot@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:59:24 +0100 Subject: [PATCH 01/93] [zh-cn] sync translated content (#17052) Co-authored-by: Jason Ren <40999116+jasonren0403@users.noreply.github.com> --- files/zh-cn/_redirects.txt | 16 +- files/zh-cn/_wikihistory.json | 24 +- .../web/api/history_api/example/index.md | 438 ------------------ .../working_with_the_history_api/index.md | 1 - .../web/api/window/popstate_event/index.md | 1 - files/zh-cn/web/guide/ajax/index.md | 2 - .../{compile => compile_static}/index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../index.md | 2 +- .../javascript_interface/module/index.md | 4 +- .../javascript_interface/table/index.md | 2 +- .../{validate => validate_static}/index.md | 8 +- 13 files changed, 32 insertions(+), 472 deletions(-) delete mode 100644 files/zh-cn/web/api/history_api/example/index.md rename files/zh-cn/webassembly/javascript_interface/{compile => compile_static}/index.md (98%) rename files/zh-cn/webassembly/javascript_interface/{compilestreaming => compilestreaming_static}/index.md (97%) rename files/zh-cn/webassembly/javascript_interface/{instantiate => instantiate_static}/index.md (99%) rename files/zh-cn/webassembly/javascript_interface/{instantiatestreaming => instantiatestreaming_static}/index.md (98%) rename files/zh-cn/webassembly/javascript_interface/{validate => validate_static}/index.md (94%) diff --git a/files/zh-cn/_redirects.txt b/files/zh-cn/_redirects.txt index 47f9de86039c7e..2dfc76f0de4d9f 100644 --- a/files/zh-cn/_redirects.txt +++ b/files/zh-cn/_redirects.txt @@ -1617,6 +1617,7 @@ /zh-CN/docs/Web/API/HTMLTableElement.deleteTHead /zh-CN/docs/Web/API/HTMLTableElement/deleteTHead /zh-CN/docs/Web/API/HTMLVideoElement/autoPictureInPicture /zh-CN/docs/Web/API/HTMLVideoElement /zh-CN/docs/Web/API/Headers/getAll /zh-CN/docs/Web/API/Headers/get +/zh-CN/docs/Web/API/History_API/Example /zh-CN/docs/Web/API/History_API/Working_with_the_History_API /zh-CN/docs/Web/API/IDBCursor.direction /zh-CN/docs/Web/API/IDBCursor/direction /zh-CN/docs/Web/API/IDBDatabase/onversionchange /zh-CN/docs/Web/API/IDBDatabase/versionchange_event /zh-CN/docs/Web/API/IDBFactory.open /zh-CN/docs/Web/API/IDBFactory/open @@ -2591,11 +2592,11 @@ /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module /zh-CN/docs/WebAssembly/JavaScript_interface/Module /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError /zh-CN/docs/WebAssembly/JavaScript_interface/RuntimeError /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table /zh-CN/docs/WebAssembly/JavaScript_interface/Table -/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compile /zh-CN/docs/WebAssembly/JavaScript_interface/compile -/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming /zh-CN/docs/WebAssembly/JavaScript_interface/compileStreaming -/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate /zh-CN/docs/WebAssembly/JavaScript_interface/instantiate -/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming /zh-CN/docs/WebAssembly/JavaScript_interface/instantiateStreaming -/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/validate /zh-CN/docs/WebAssembly/JavaScript_interface/validate +/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compile /zh-CN/docs/WebAssembly/JavaScript_interface/compile_static +/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming /zh-CN/docs/WebAssembly/JavaScript_interface/compileStreaming_static +/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate /zh-CN/docs/WebAssembly/JavaScript_interface/instantiate_static +/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming /zh-CN/docs/WebAssembly/JavaScript_interface/instantiateStreaming_static +/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/validate /zh-CN/docs/WebAssembly/JavaScript_interface/validate_static /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/null /zh-CN/docs/Web/JavaScript/Reference/Operators/null /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/uneval /zh-CN/docs/Web/JavaScript/Reference/Global_Objects /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/生成器函数 /zh-CN/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction @@ -2693,6 +2694,11 @@ /zh-CN/docs/Web/性能 /zh-CN/docs/Web/Performance /zh-CN/docs/Web/演示说明 /zh-CN/docs/Web/Demos /zh-CN/docs/WebAPI/Using_geolocation /zh-CN/docs/Web/API/Geolocation_API +/zh-CN/docs/WebAssembly/JavaScript_interface/compile /zh-CN/docs/WebAssembly/JavaScript_interface/compile_static +/zh-CN/docs/WebAssembly/JavaScript_interface/compileStreaming /zh-CN/docs/WebAssembly/JavaScript_interface/compileStreaming_static +/zh-CN/docs/WebAssembly/JavaScript_interface/instantiate /zh-CN/docs/WebAssembly/JavaScript_interface/instantiate_static +/zh-CN/docs/WebAssembly/JavaScript_interface/instantiateStreaming /zh-CN/docs/WebAssembly/JavaScript_interface/instantiateStreaming_static +/zh-CN/docs/WebAssembly/JavaScript_interface/validate /zh-CN/docs/WebAssembly/JavaScript_interface/validate_static /zh-CN/docs/WebAssembly/概念 /zh-CN/docs/WebAssembly/Concepts /zh-CN/docs/WebGL /zh-CN/docs/Web/API/WebGL_API /zh-CN/docs/WebGL/Getting_started_with_WebGL /zh-CN/docs/Web/API/WebGL_API/Tutorial/Getting_started_with_WebGL diff --git a/files/zh-cn/_wikihistory.json b/files/zh-cn/_wikihistory.json index 316a781e06e56e..ea4d243d1e45f5 100644 --- a/files/zh-cn/_wikihistory.json +++ b/files/zh-cn/_wikihistory.json @@ -10932,10 +10932,6 @@ "xgqfrms-GitHub" ] }, - "Web/API/History_API/Example": { - "modified": "2019-07-31T00:29:31.092Z", - "contributors": ["Shadowhiker", "xgqfrms"] - }, "Web/API/History_API/Working_with_the_History_API": { "modified": "2020-09-07T23:10:09.451Z", "contributors": ["Nothing_bin"] @@ -32727,23 +32723,23 @@ "modified": "2020-11-04T03:44:08.051Z", "contributors": ["moniang", "hurrytospring"] }, - "WebAssembly/JavaScript_interface/compile": { - "modified": "2020-10-15T21:58:44.128Z", - "contributors": ["kungfucode-rex"] - }, - "WebAssembly/JavaScript_interface/compileStreaming": { + "WebAssembly/JavaScript_interface/compileStreaming_static": { "modified": "2020-10-15T22:15:30.451Z", "contributors": ["Cyandev"] }, - "WebAssembly/JavaScript_interface/instantiate": { - "modified": "2020-10-15T21:57:59.458Z", - "contributors": ["wallena3", "Hedgehog", "airt", "kungfucode-rex"] + "WebAssembly/JavaScript_interface/compile_static": { + "modified": "2020-10-15T21:58:44.128Z", + "contributors": ["kungfucode-rex"] }, - "WebAssembly/JavaScript_interface/instantiateStreaming": { + "WebAssembly/JavaScript_interface/instantiateStreaming_static": { "modified": "2020-10-15T22:11:30.410Z", "contributors": ["Xiaoming666"] }, - "WebAssembly/JavaScript_interface/validate": { + "WebAssembly/JavaScript_interface/instantiate_static": { + "modified": "2020-10-15T21:57:59.458Z", + "contributors": ["wallena3", "Hedgehog", "airt", "kungfucode-rex"] + }, + "WebAssembly/JavaScript_interface/validate_static": { "modified": "2020-10-15T22:15:29.365Z", "contributors": ["Cyandev"] }, diff --git a/files/zh-cn/web/api/history_api/example/index.md b/files/zh-cn/web/api/history_api/example/index.md deleted file mode 100644 index ca922fdfb2ab4b..00000000000000 --- a/files/zh-cn/web/api/history_api/example/index.md +++ /dev/null @@ -1,438 +0,0 @@ ---- -title: Ajax navigation example -slug: Web/API/History_API/Example ---- - -这是一个仅由三个页面组成的 AJAX 网站示例 (_first_page.php_, _second_page.php_ and _third_page.php_). 要查看其如何工作的,请创建以下文件 (或 git clone [https://github.com/giabao/mdn-ajax-nav-example.git](https://github.com/giabao/mdn-ajax-nav-example) ): - -> **备注:** 为了在该机制中很好地整合 {{HTMLElement("form")}} 元素 , 请看一下这段[提交表单和上传文件](/zh-CN/docs/Web/API/XMLHttpRequest_API/Using_XMLHttpRequest#提交表单和上传文件)。 - -**first_page.php**: - -```php - - - -
-" . $page_title . ""; -?> - - - - - - -This paragraph is shown only when the navigation starts from first_page.php.
- -This is the content of first_page.php.
- - $page_title, "content" => ob_get_clean())); - } else { -?> -This paragraph is shown only when the navigation starts from first_page.php.
- -\n"; - } -?> -``` - -**second_page.php**: - -```php - - - - -" . $page_title . ""; -?> - - - - - - -This paragraph is shown only when the navigation starts from second_page.php.
- -This is the content of second_page.php.
- - $page_title, "content" => ob_get_clean())); - } else { -?> -This paragraph is shown only when the navigation starts from second_page.php.
- -\n"; - } -?> -``` - -**third_page.php**: - -```php -This is the content of third_page.php. This content is stored into a php variable."; - - if (isset($_GET["view_as"]) && $_GET["view_as"] == "json") { - echo json_encode(array("page" => $page_title, "content" => $page_content)); - } else { -?> - - - -" . $page_title . ""; -?> - - - - - - -This paragraph is shown only when the navigation starts from third_page.php.
- -This paragraph is shown only when the navigation starts from third_page.php.
- -\n"; - } -?> -``` - -**css/style.css**: - -```css -#ajax-loader { - position: fixed; - display: table; - top: 0; - left: 0; - width: 100%; - height: 100%; -} - -#ajax-loader > div { - display: table-cell; - width: 100%; - height: 100%; - vertical-align: middle; - text-align: center; - background-color: #000000; - opacity: 0.65; -} -``` - -**include/after_content.php**: - -```php -This is the footer. It is shared between all ajax pages.
-``` - -**include/before_content.php**: - -```php --[ First example -| Second example -| Third example -| Unexisting page ] -
-``` - -**include/header.php**: - -```php - - - -``` - -**js/ajax_nav.js**: - -```js -"use strict"; - -const ajaxRequest = new (function () { - function closeReq() { - oLoadingBox.parentNode && document.body.removeChild(oLoadingBox); - bIsLoading = false; - } - - function abortReq() { - if (!bIsLoading) { - return; - } - oReq.abort(); - closeReq(); - } - - function ajaxError() { - alert("Unknown error."); - } - - function ajaxLoad() { - var vMsg, - nStatus = this.status; - switch (nStatus) { - case 200: - vMsg = JSON.parse(this.responseText); - document.title = oPageInfo.title = vMsg.page; - document.getElementById(sTargetId).innerHTML = vMsg.content; - if (bUpdateURL) { - history.pushState(oPageInfo, oPageInfo.title, oPageInfo.url); - bUpdateURL = false; - } - break; - default: - vMsg = nStatus + ": " + (oHTTPStatus[nStatus] || "Unknown"); - switch (Math.floor(nStatus / 100)) { - /* - case 1: - // Informational 1xx - console.log("Information code " + vMsg); - break; - case 2: - // Successful 2xx - console.log("Successful code " + vMsg); - break; - case 3: - // Redirection 3xx - console.log("Redirection code " + vMsg); - break; - */ - case 4: - /* Client Error 4xx */ - alert("Client Error #" + vMsg); - break; - case 5: - /* Server Error 5xx */ - alert("Server Error #" + vMsg); - break; - default: - /* Unknown status */ - ajaxError(); - } - } - closeReq(); - } - - function filterURL(sURL, sViewMode) { - return ( - sURL.replace(rSearch, "") + - ( - "?" + - sURL - .replace(rHost, "&") - .replace(rView, sViewMode ? "&" + sViewKey + "=" + sViewMode : "") - .slice(1) - ).replace(rEndQstMark, "") - ); - } - - function getPage(sPage) { - if (bIsLoading) { - return; - } - oReq = new XMLHttpRequest(); - bIsLoading = true; - oReq.onload = ajaxLoad; - oReq.onerror = ajaxError; - if (sPage) { - oPageInfo.url = filterURL(sPage, null); - } - oReq.open("get", filterURL(oPageInfo.url, "json"), true); - oReq.send(); - oLoadingBox.parentNode || document.body.appendChild(oLoadingBox); - } - - function requestPage(sURL) { - if (history.pushState) { - bUpdateURL = true; - getPage(sURL); - } else { - /* Ajax navigation is not supported */ - location.assign(sURL); - } - } - - function processLink() { - if (this.className === sAjaxClass) { - requestPage(this.href); - return false; - } - return true; - } - - function init() { - oPageInfo.title = document.title; - history.replaceState(oPageInfo, oPageInfo.title, oPageInfo.url); - for ( - var oLink, nIdx = 0, nLen = document.links.length; - nIdx < nLen; - document.links[nIdx++].onclick = processLink - ); - } - - const /* customizable constants */ - sTargetId = "ajax-content", - sViewKey = "view_as", - sAjaxClass = "ajax-nav", - /* not customizable constants */ - rSearch = /\?.*$/, - rHost = /^[^\?]*\?*&*/, - rView = new RegExp("&" + sViewKey + "\\=[^&]*|&*$", "i"), - rEndQstMark = /\?$/, - oLoadingBox = document.createElement("div"), - oCover = document.createElement("div"), - oLoadingImg = new Image(), - oPageInfo = { - title: null, - url: location.href, - }, - oHTTPStatus = - /* http://www.iana.org/assignments/http-status-codes/http-status-codes.xml */ { - 100: "Continue", - 101: "Switching Protocols", - 102: "Processing", - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-Authoritative Information", - 204: "No Content", - 205: "Reset Content", - 206: "Partial Content", - 207: "Multi-Status", - 208: "Already Reported", - 226: "IM Used", - 300: "Multiple Choices", - 301: "Moved Permanently", - 302: "Found", - 303: "See Other", - 304: "Not Modified", - 305: "Use Proxy", - 306: "Reserved", - 307: "Temporary Redirect", - 308: "Permanent Redirect", - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 405: "Method Not Allowed", - 406: "Not Acceptable", - 407: "Proxy Authentication Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Request Entity Too Large", - 414: "Request-URI Too Long", - 415: "Unsupported Media Type", - 416: "Requested Range Not Satisfiable", - 417: "Expectation Failed", - 422: "Unprocessable Entity", - 423: "Locked", - 424: "Failed Dependency", - 425: "Unassigned", - 426: "Upgrade Required", - 427: "Unassigned", - 428: "Precondition Required", - 429: "Too Many Requests", - 430: "Unassigned", - 431: "Request Header Fields Too Large", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported", - 506: "Variant Also Negotiates (Experimental)", - 507: "Insufficient Storage", - 508: "Loop Detected", - 509: "Unassigned", - 510: "Not Extended", - 511: "Network Authentication Required", - }; - - var oReq, - bIsLoading = false, - bUpdateURL = false; - - oLoadingBox.id = "ajax-loader"; - oCover.onclick = abortReq; - oLoadingImg.src = - "data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA=="; - oCover.appendChild(oLoadingImg); - oLoadingBox.appendChild(oCover); - - onpopstate = function (oEvent) { - bUpdateURL = false; - oPageInfo.title = oEvent.state.title; - oPageInfo.url = oEvent.state.url; - getPage(); - }; - - window.addEventListener - ? addEventListener("load", init, false) - : window.attachEvent - ? attachEvent("onload", init) - : (onload = init); - - // Public methods - - this.open = requestPage; - this.stop = abortReq; - this.rebuildLinks = init; -})(); -``` - -For more information, please see: [Manipulating the browser history](/zh-CN/docs/DOM/Manipulating_the_browser_history). - -## See also - -- {{ domxref("window.history") }} -- {{ domxref("window.onpopstate") }} diff --git a/files/zh-cn/web/api/history_api/working_with_the_history_api/index.md b/files/zh-cn/web/api/history_api/working_with_the_history_api/index.md index 54795924d25c51..8375f748c2f446 100644 --- a/files/zh-cn/web/api/history_api/working_with_the_history_api/index.md +++ b/files/zh-cn/web/api/history_api/working_with_the_history_api/index.md @@ -103,5 +103,4 @@ const currentState = history.state; ## 参见 - [历史记录 API](/zh-CN/docs/Web/API/History_API) -- [历史导航示例](/zh-CN/docs/Web/API/History_API/Example) - {{domxref("window.history", "history")}} 全局对象 diff --git a/files/zh-cn/web/api/window/popstate_event/index.md b/files/zh-cn/web/api/window/popstate_event/index.md index 661a63523bf962..1ddb2637832bb9 100644 --- a/files/zh-cn/web/api/window/popstate_event/index.md +++ b/files/zh-cn/web/api/window/popstate_event/index.md @@ -55,4 +55,3 @@ history.go(2); // 弹出 "location: http://example.com/example.html?page=3, stat - {{domxref("window.history")}} - [Manipulating the browser history](/zh-CN/docs/Web/API/History_API) -- [Ajax 导航示例](/zh-CN/docs/Web/API/History_API/Example) diff --git a/files/zh-cn/web/guide/ajax/index.md b/files/zh-cn/web/guide/ajax/index.md index 958a51fa26299b..520ba63fa0270c 100644 --- a/files/zh-cn/web/guide/ajax/index.md +++ b/files/zh-cn/web/guide/ajax/index.md @@ -352,8 +352,6 @@ TIME: 312.15 - [监控请求过程](/zh-CN/docs/Web/API/XMLHttpRequest_API/Using_XMLHttpRequest#监控请求过程) - [提交表单或者上传二进制文件](/zh-CN/docs/Web/API/XMLHttpRequest_API/Using_XMLHttpRequest#提交表单和上传文件),使用*纯* Ajax 或者 {{domxref("FormData")}} 对象 - 在 [Web worker](/zh-CN/docs/Web/API/Worker) 中使用 Ajax -- [_纯 Ajax_ 导航示例](/zh-CN/docs/Web/API/History_API/Example) - - : 本文提供了一个仅由三个页面组成的*纯 Ajax* 网站的(最小)工作示例。 - [发送和接收二进制数据](/zh-CN/docs/Web/API/XMLHttpRequest_API/Sending_and_Receiving_Binary_Data) - : `XMLHttpRequest` 对象的 `responseType` 属性可以被设置来改变服务器的预期响应类型。可能的值是空字符串(默认)、`arraybuffer`、`blob`、`document`、`json` 和 `text`。`response` 属性将根据 `responseType` 包含,作为一个 `ArrayBuffer`、`Blob`、`Document`、`JSON` 或字符串的实体主体。这篇文章将展示一些 Ajax I/O 技术。 - [XML](/zh-CN/docs/Glossary/XML) diff --git a/files/zh-cn/webassembly/javascript_interface/compile/index.md b/files/zh-cn/webassembly/javascript_interface/compile_static/index.md similarity index 98% rename from files/zh-cn/webassembly/javascript_interface/compile/index.md rename to files/zh-cn/webassembly/javascript_interface/compile_static/index.md index fa96023f21d61f..75f372c92b7c98 100644 --- a/files/zh-cn/webassembly/javascript_interface/compile/index.md +++ b/files/zh-cn/webassembly/javascript_interface/compile_static/index.md @@ -1,6 +1,6 @@ --- title: WebAssembly.compile() -slug: WebAssembly/JavaScript_interface/compile +slug: WebAssembly/JavaScript_interface/compile_static --- {{WebAssemblySidebar}} {{SeeCompatTable}} diff --git a/files/zh-cn/webassembly/javascript_interface/compilestreaming/index.md b/files/zh-cn/webassembly/javascript_interface/compilestreaming_static/index.md similarity index 97% rename from files/zh-cn/webassembly/javascript_interface/compilestreaming/index.md rename to files/zh-cn/webassembly/javascript_interface/compilestreaming_static/index.md index d09e5f43cfc841..7712cf635f2237 100644 --- a/files/zh-cn/webassembly/javascript_interface/compilestreaming/index.md +++ b/files/zh-cn/webassembly/javascript_interface/compilestreaming_static/index.md @@ -1,6 +1,6 @@ --- title: WebAssembly.compileStreaming() -slug: WebAssembly/JavaScript_interface/compileStreaming +slug: WebAssembly/JavaScript_interface/compileStreaming_static --- {{WebAssemblySidebar}} diff --git a/files/zh-cn/webassembly/javascript_interface/instantiate/index.md b/files/zh-cn/webassembly/javascript_interface/instantiate_static/index.md similarity index 99% rename from files/zh-cn/webassembly/javascript_interface/instantiate/index.md rename to files/zh-cn/webassembly/javascript_interface/instantiate_static/index.md index 42b12fe9762178..6a37cecba9c51c 100644 --- a/files/zh-cn/webassembly/javascript_interface/instantiate/index.md +++ b/files/zh-cn/webassembly/javascript_interface/instantiate_static/index.md @@ -1,6 +1,6 @@ --- title: WebAssembly.instantiate() -slug: WebAssembly/JavaScript_interface/instantiate +slug: WebAssembly/JavaScript_interface/instantiate_static --- {{WebAssemblySidebar}} diff --git a/files/zh-cn/webassembly/javascript_interface/instantiatestreaming/index.md b/files/zh-cn/webassembly/javascript_interface/instantiatestreaming_static/index.md similarity index 98% rename from files/zh-cn/webassembly/javascript_interface/instantiatestreaming/index.md rename to files/zh-cn/webassembly/javascript_interface/instantiatestreaming_static/index.md index d218492e64254a..4afe43422c976f 100644 --- a/files/zh-cn/webassembly/javascript_interface/instantiatestreaming/index.md +++ b/files/zh-cn/webassembly/javascript_interface/instantiatestreaming_static/index.md @@ -1,6 +1,6 @@ --- title: WebAssembly.instantiateStreaming() -slug: WebAssembly/JavaScript_interface/instantiateStreaming +slug: WebAssembly/JavaScript_interface/instantiateStreaming_static --- {{WebAssemblySidebar}} diff --git a/files/zh-cn/webassembly/javascript_interface/module/index.md b/files/zh-cn/webassembly/javascript_interface/module/index.md index 4d075dbfa2170f..99bbd553352b32 100644 --- a/files/zh-cn/webassembly/javascript_interface/module/index.md +++ b/files/zh-cn/webassembly/javascript_interface/module/index.md @@ -25,7 +25,7 @@ slug: WebAssembly/JavaScript_interface/Module ### 将编译后的模块发送到 worker -以下示例将使用 [`WebAssembly.compileStreaming()`](/zh-CN/docs/WebAssembly/JavaScript_interface/compileStreaming) 方法编译 `simple.wasm` 加载后的字节码,并将返回的 `Module` 实例通过 {{domxref("Worker/postMessage", "postMessage()")}} 发送到一个 [worker](/zh-CN/docs/Web/API/Web_Workers_API)。 +以下示例将使用 [`WebAssembly.compileStreaming()`](/zh-CN/docs/WebAssembly/JavaScript_interface/compileStreaming_static) 方法编译 `simple.wasm` 加载后的字节码,并将返回的 `Module` 实例通过 {{domxref("Worker/postMessage", "postMessage()")}} 发送到一个 [worker](/zh-CN/docs/Web/API/Web_Workers_API)。 参见 `index-compile.html` 的[源代码](https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/index-compile.html),或[查看在线演示](https://mdn.github.io/webassembly-examples/js-api-examples/index-compile.html)。 @@ -37,7 +37,7 @@ WebAssembly.compileStreaming(fetch("simple.wasm")).then((mod) => ); ``` -Worker 函数 [`wasm_worker.js`](https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/wasm_worker.js) 定义了模块需要使用的导入对象。然后,该函数会创建一个事件处理器,以接受主线程发送的模块。在接收到模块后,我们使用 [`WebAssembly.instantiate()`](/zh-CN/docs/WebAssembly/JavaScript_interface/instantiate) 方法创建一个它的实例,然后调用其导出的函数。 +Worker 函数 [`wasm_worker.js`](https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/wasm_worker.js) 定义了模块需要使用的导入对象。然后,该函数会创建一个事件处理器,以接受主线程发送的模块。在接收到模块后,我们使用 [`WebAssembly.instantiate()`](/zh-CN/docs/WebAssembly/JavaScript_interface/instantiate_static) 方法创建一个它的实例,然后调用其导出的函数。 ```js const importObject = { diff --git a/files/zh-cn/webassembly/javascript_interface/table/index.md b/files/zh-cn/webassembly/javascript_interface/table/index.md index d4ac1c32b398de..68aa65776c4f57 100644 --- a/files/zh-cn/webassembly/javascript_interface/table/index.md +++ b/files/zh-cn/webassembly/javascript_interface/table/index.md @@ -51,7 +51,7 @@ const importObj = { }; ``` -最后,我们使用 [`WebAssembly.instantiateStreaming()`](/zh-CN/docs/WebAssembly/JavaScript_interface/instantiateStreaming) 方法加载并实例化一个 Wasm 模块(table2.wasm)。table2.wasm 模块包含两个函数(一个返回 42,另一个返回 83),并将这两个函数分别存储到导入 Table 的 0 号和 1 号元素中(参见[文本表示](https://github.com/mdn/webassembly-examples/blob/main/js-api-examples/table2.wat))。因此,在实例化之后,表的长度仍然是 2,但元素中现在包含了可调用的 [WebAssembly 导出函数](/zh-CN/docs/WebAssembly/Exported_functions),可以通过 JS 调用这些函数。 +最后,我们使用 [`WebAssembly.instantiateStreaming()`](/zh-CN/docs/WebAssembly/JavaScript_interface/instantiateStreaming_static) 方法加载并实例化一个 Wasm 模块(table2.wasm)。table2.wasm 模块包含两个函数(一个返回 42,另一个返回 83),并将这两个函数分别存储到导入 Table 的 0 号和 1 号元素中(参见[文本表示](https://github.com/mdn/webassembly-examples/blob/main/js-api-examples/table2.wat))。因此,在实例化之后,表的长度仍然是 2,但元素中现在包含了可调用的 [WebAssembly 导出函数](/zh-CN/docs/WebAssembly/Exported_functions),可以通过 JS 调用这些函数。 ```js WebAssembly.instantiateStreaming(fetch("table2.wasm"), importObject).then( diff --git a/files/zh-cn/webassembly/javascript_interface/validate/index.md b/files/zh-cn/webassembly/javascript_interface/validate_static/index.md similarity index 94% rename from files/zh-cn/webassembly/javascript_interface/validate/index.md rename to files/zh-cn/webassembly/javascript_interface/validate_static/index.md index dd4d7629bb3e85..8f9e2efc1e8278 100644 --- a/files/zh-cn/webassembly/javascript_interface/validate/index.md +++ b/files/zh-cn/webassembly/javascript_interface/validate_static/index.md @@ -1,6 +1,6 @@ --- title: WebAssembly.validate() -slug: WebAssembly/JavaScript_interface/validate +slug: WebAssembly/JavaScript_interface/validate_static --- {{WebAssemblySidebar}} @@ -41,15 +41,15 @@ fetch("simple.wasm") }); ``` -## Specifications +## 规范 {{Specifications}} -## Browser compatibility +## 浏览器兼容性 {{Compat}} -## See also +## 参见 - [WebAssembly](/zh-CN/docs/WebAssembly) overview page - [WebAssembly concepts](/zh-CN/docs/WebAssembly/Concepts) From 6a1b9093050b21e51942d071b461678173d142d2 Mon Sep 17 00:00:00 2001 From: Jason Ren <40999116+jasonren0403@users.noreply.github.com> Date: Tue, 21 Nov 2023 19:01:00 +0800 Subject: [PATCH 02/93] [zh-cn] update & finish translation of 'keyboard navigable javascript widgets' (#16752) Co-authored-by: A1lo