{"id":385,"date":"2018-12-13T21:10:07","date_gmt":"2018-12-13T13:10:07","guid":{"rendered":"https:\/\/www.myway5.com\/?p=385"},"modified":"2023-07-05T21:43:07","modified_gmt":"2023-07-05T13:43:07","slug":"go-webassembly","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/","title":{"rendered":"go WebAssembly\u521d\u4f53\u9a8c"},"content":{"rendered":"<p>WebAssembly\u662f\u4e00\u95e8\u65b0\u7684\u6d4f\u89c8\u5668\u6280\u672f\u3002\u53ef\u4ee5\u53d6\u4ee3\u4e00\u90e8\u5206js\u7684\u89d2\u8272\uff0c\u5e76\u4e14\u4ece\u6027\u80fd\u4e0a\u6765\u8bf4\uff0c\u8981\u6bd4js\u597d\u5f88\u591a\u3002WebAssembly\u76ee\u524d\u8fd8\u5904\u4e8e\u65e9\u671f\u7684\u53d1\u5c55\u9636\u6bb5\uff0c\u4ecd\u7136\u4e0d\u591f\u6210\u719f\u3002go\u8bed\u8a00\u5bf9WebAssembly\u7684\u652f\u6301\u4e5f\u662f\u57281.11\u7248\u672c\u4e0a\u521a\u521a\u52a0\u5165\u3002\u867d\u7136\u4e0d\u80fd\u6295\u5165\u751f\u4ea7\u73af\u5883\uff0c\u4f46\u662f\u53ef\u4ee5\u7528\u6765\u505a\u4e00\u4e9b\u5f88\u6709\u610f\u601d\u7684\u4e8b\u60c5\u3002<\/p>\n<p>\u5b98\u65b9WebAssembly\u7684\u6587\u6863\uff1ahttps:\/\/github.com\/golang\/go\/wiki\/WebAssembly\u3002\u8be6\u7ec6\u7684\u4ecb\u7ecd\u53ef\u4ee5\u770b\u5b98\u65b9\u7684\u6587\u6863\u3002<\/p>\n<h2>\u4e00\u4e2ago WebAssembly\u7684\u4f8b\u5b50<\/h2>\n<p>main.go<\/p>\n<pre><code class=\"line-numbers\">package main\n\nimport \"fmt\"\n\nfunc main() {\n    fmt.Println(\"hello WebAssembly\")\n}\n<\/code><\/pre>\n<p>\u7f16\u8bd1\u8fd9\u4e2ago\u6587\u4ef6: <code>GOOS=js GOARCH=wasm go build -o main.wasm main.go<\/code><\/p>\n<p>index.html<\/p>\n<pre><code class=\"line-numbers\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;meta charset=\"utf-8\"&gt;\n    &lt;title&gt;Go wasm&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;script src=\"wasm_exec.js\"&gt;&lt;\/script&gt;\n    &lt;script&gt;\n        const go = new Go();\n        WebAssembly.instantiateStreaming(\n            fetch(\"main.wasm\"),go.importObject).then((result) =&gt; {\n            go.run(result.instance)\n        });\n\n    &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<p>\u8fd9\u91cc\u8fd8\u9700\u8981\u4e00\u4e2a<code>wasm_exec.js<\/code>\u3002\u8fd9\u4e2a\u6587\u4ef6\u662f\u5b98\u65b9\u63d0\u4f9b\u7684\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3a\u662fgo\u7f16\u8bd1\u51fa\u6765\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u548cjs\u95f4\u7684\u8fde\u63a5\u6865\u6881\u3002\u8fd9\u4e2a\u65f6\u5019\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u53ef\u4ee5\u770b\u5230\u63a7\u5236\u53f0\u4e0b\u6709\uff1a<code>hello WebAssembly<\/code>\u3002<\/p>\n<p>\u9700\u8981\u8bf4\u660e\u7684\u662f\uff0c\u5728go\u91cc\u9762\u7684\u6240\u6709STDOUT\uff0c\u90fd\u4f1a\u5728\u6d4f\u89c8\u5668\u7684\u63a7\u5236\u53f0\u6253\u5370\u51fa\u6765\u3002<\/p>\n<h2>wasm\u7684\u521d\u59cb\u5316\u8fc7\u7a0b<\/h2>\n<p><code>WebAssembly.instantiateStreaming(fetch(\"main.wasm\"),go.importObject)<\/code>\u3002\u6d4f\u89c8\u5668\u6267\u884c\u8fd9\u6837\u4e00\u6bb5\u4ee3\u7801\u6765\u52a0\u8f7d<code>main.wasm<\/code>\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2aPromise\u5bf9\u8c61\u3002\u5728\u52a0\u8f7d\u5b8c\u6bd5\u4e4b\u540e\uff0c\u8c03\u7528<code>go.run(result.instance)<\/code>\u6765\u6267\u884cwasm\u4e2d\u7684\u4ee3\u7801\u3002<\/p>\n<p>\u52a0\u8f7d\u4e00\u4e2awasm\u6587\u4ef6\u5c31\u662f\u8fd9\u6837\u7684\u7b80\u5355\u3002<\/p>\n<h2>go WebAssembly\u5982\u4f55\u548cjs\u4ea4\u4e92<\/h2>\n<p>\u4e0a\u9762\u7684\u4f8b\u5b50\u975e\u5e38\u7b80\u5355\u3002\u4f46\u662fWebAssembly\u6280\u672f\u7edd\u975e\u8fd9\u6837\u7b80\u5355\u3002\u6211\u4eec\u53ef\u4ee5\u5728go\u4e2d\u8f7b\u677e\u7684\u8c03\u7528js\u4e2d\u7684\u65b9\u6cd5\u3002\u6bd4\u5982\u4e0b\u9762\u8fd9\u53e5\u8bdd\uff1a<\/p>\n<pre><code class=\"line-numbers\">js.Global().Get(\"document\").Call(\"getElementById\", \"maxCubes\").Set(\"value\", 256)\n<\/code><\/pre>\n<p>\u76f8\u5f53\u4e8ejs\u4e2d\u7684<\/p>\n<pre><code class=\"line-numbers\">document.getElementById(\"maxCubes).setAttribute('value', 256)\n<\/code><\/pre>\n<p>\u540c\u6837\u7684\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u5728go\u4e2d\u5b9a\u4e49js\u65b9\u6cd5\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728js\u4e2d\u76f4\u63a5\u8c03\u7528\u4e86\u3002<\/p>\n<pre><code class=\"line-numbers\">api.onMemInitCb = js.NewCallback(func(args []js.Value) {\n        length := args[0].Int()\n        api.console.Call(\"log\", \"length\", length) \/\/ \u8c03\u7528js\u7684console.log(\"length\", length)\n        api.inBuf = make([]uint8, length)\n        \/\/ \u62ff\u5230\u8fd9\u4e2aslice\u7684SliceHeader\n        hdr := (*reflect.SliceHeader)(unsafe.Pointer(&amp;api.inBuf))\n        ptr := uintptr(unsafe.Pointer(hdr.Data))\n\n        api.console.Call(\"log\", \"ptr:\", ptr)\n        js.Global().Call(\"gotMem\", ptr)\n\n        fmt.Println(\"\u521d\u59cb\u5316Mem\u6210\u529f\")\n    })\n\njs.Global().Set(\"initMem\", api.onMemInitCb)\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5728js\u4e2d\u76f4\u63a5\u4f7f\u7528<code>initMem<\/code>\u65b9\u6cd5\u4e86\u3002\u8fd9\u6837\u5b50\uff0c\u5c31\u76f8\u5f53\u4e8e\u6253\u901a\u4e86go\u548cjs\u4e4b\u95f4\u7684\u901a\u9053\uff0c\u4f7f\u5f97go WebAssembly\u51e0\u4e4e\u65e0\u6240\u4e0d\u80fd\u3002<\/p>\n<h2>go\u548cjs\u4e4b\u95f4\u5982\u4f55\u901a\u8fc7\u5185\u5b58\u4f20\u503c\u3002<\/h2>\n<p>\u8fd9\u4e2a\u90e8\u5206\u662f\u6211\u5728\u770bgo WebAssembly\u90e8\u5206\u65f6\u6700\u5173\u6ce8\u7684\u3002\u56e0\u4e3a\u5927\u591a\u6570\u65f6\u5019\uff0c\u6211\u4eec\u4f20\u53c2\u90fd\u4e0d\u4ec5\u4ec5\u662f<code>256<\/code>\u8fd9\u6837\u7684\u5b57\u9762\u503c\u3002\u6bd4\u5982\u6211\u4eec\u5728\u505a\u56fe\u7247\u5904\u7406\u7684\u65f6\u5019\uff0c\u6d4f\u89c8\u5668\u52a0\u8f7d\u56fe\u7247\u540e\u4f20\u7ed9wasm\u53bb\u5904\u7406\uff0c\u8fd9\u79cd\u65f6\u5019\u4f20\u9012\u7684\u80af\u5b9a\u662f\u4e00\u4e2a\u6307\u5411\u4e00\u6bb5\u5185\u5b58\u7684\u6307\u9488\u3002<\/p>\n<p>go\u4ee3\u7801\u4e2d\uff1a<\/p>\n<pre><code class=\"line-numbers\">api.onMemInitCb = js.NewCallback(func(args []js.Value) {\n    length := args[0].Int()\n    api.console.Call(\"log\", \"length\", length) \/\/ \u8c03\u7528js\u7684console.log(\"length\", length)\n    api.inBuf = make([]uint8, length)\n    \/\/ \u62ff\u5230\u8fd9\u4e2aslice\u7684SliceHeader\n    hdr := (*reflect.SliceHeader)(unsafe.Pointer(&amp;api.inBuf))\n    ptr := uintptr(unsafe.Pointer(hdr.Data))\n\n    api.console.Call(\"log\", \"ptr:\", ptr)\n    js.Global().Call(\"gotMem\", ptr)\n\n    fmt.Println(\"\u521d\u59cb\u5316Mem\u6210\u529f\")\n})\n<\/code><\/pre>\n<p>js\u4ee3\u7801\u4e2d\uff1a<\/p>\n<pre><code class=\"line-numbers\">function gotMem(pointer) {\n\n    console.log(\"pointer\", pointer)\n\n    memoryBytes.set(bytes, pointer);\n    \/\/ Now the image can be loaded from the slice.\n\n    console.log(\"load image\")\n    loadImage();\n}\n\n......\n\nlet reader = new FileReader();\nreader.onload = (ev) =&gt; {\n    bytes = new Uint8Array(ev.target.result);\n    initMem(bytes.length);\n    let blob = new Blob([bytes], {'type': imageType});\n    document.getElementById(\"sourceImg\").src = URL.createObjectURL(blob);\n};\nimageType = this.files[0].type;\nreader.readAsArrayBuffer(this.files[0]);\n<\/code><\/pre>\n<p>\u4e0a\u9762\u6709\u4e24\u6bb5\u4ee3\u7801\uff0cjs\u90e8\u5206\u4ee3\u7801\u662f\u5728\u52a0\u8f7d\u4e00\u5f20\u56fe\u7247\uff0c\u7136\u540e\u8f6c\u6362\u4e3a<code>Uint8Array<\/code>\u6570\u7ec4bytes\uff0c\u7136\u540e\u8c03\u7528<code>initMem<\/code>\u65b9\u6cd5\uff0c\u4f20\u9012\u4e00\u4e2a\u6570\u7ec4bytes\u7684\u957f\u5ea6\u4f5c\u4e3a\u53c2\u6570\u3002\u800c<code>initMem<\/code>\u662f\u5728go\u4ee3\u7801\u4e2d\u5b9a\u4e49\u7684\uff0c<code>initMem<\/code>\u8d1f\u8d23\u8c03\u7528<code>make([]uint8, length)<\/code>\u53bb\u521d\u59cb\u5316\u9700\u8981\u7684\u5185\u5b58\u3002\u7136\u540e\u901a\u8fc7\u4e00\u7cfb\u5217\u7684\u8f6c\u6362\u83b7\u5f97\u7533\u8bf7\u7684\u5185\u5b58\u533a\u57df\u7684\u6307\u9488<code>ptr<\/code>\u3002\u7136\u540e\u8c03\u7528js\u7684<code>gotMem<\/code>\u5c06\u8fd9\u4e2a<code>ptr<\/code>\u4f20\u9012\u7ed9js\u4ee3\u7801\u3002\u5728<code>gotMem<\/code>\u4e2d\uff0c<code>memoryBytes.set(bytes, pointer)<\/code>\u8fd9\u53e5\u4ee3\u7801\u521d\u59cb\u5316\u4e86\u8fd9\u5757\u5185\u5b58\u3002<\/p>\n<p>\u8fd9\u91cc\u503c\u5f97\u6307\u51fa\u7684\u662f\uff0c<code>memoryBytes<\/code>\u662f\u4e00\u6bb5\u5728wasm\u521d\u59cb\u5316\u65f6\u7533\u8bf7\u7684\u5185\u5b58\uff0c\u4fdd\u5b58\u5728\u4e00\u4e2a<code>Uint8Array<\/code>\u6570\u7ec4\u4e2d\u3002\u5982\u679c\u6211\u4eec\u6253\u5370\u51fa\u6765\u7684\u8bdd\uff0c\u53ef\u4ee5\u53d1\u73b0\u8fd9\u6bb5\u5185\u5b58\u67091G\u3002\u7136\u540e\u6211\u4eec\u7684go\u4ee3\u7801\u4e2d\u8c03\u7528<code>make([]uint8, length)<\/code>\u7533\u8bf7\u4e00\u5757\u5185\u5b58\u65f6\uff0c\u5176\u5b9e\u662f\u5728\u8fd9\u6bb5\u5185\u5b58\u4e2d\u7533\u8bf7\u7684\u3002\u6bd4\u5982\u8bf4\u7533\u8bf7\u7684\u533a\u57df\u4e3a<code>201883648~(201883648+107003)<\/code>\u3002\u6211\u4eec\u53ea\u8981\u5728js\u4e2d\u5411<code>memoryBytes<\/code>\u7684\u6570\u7ec4\u4e2d\u7ed9\u8fd9\u5757\u533a\u57df\u8d4b\u503c\uff0c\u5c31\u628a\u503c\u4f20\u9012\u7ed9go\u7684\u5bf9\u8c61\u4e86\u3002<\/p>\n<p>\u518d\u8003\u8651\u4e00\u4e2a\u95ee\u9898\u30021G\u7684\u521d\u59cb\u5316\u5185\u5b58\u662f\u4e0d\u662f\u592a\u5927\u4e86\uff1f\u8fd9\u4e2a\u5185\u5b58\u662f\u5728\u7f16\u8bd1go\u4ee3\u7801\u65f6\u7531\u7f16\u8bd1\u5de5\u5177\u6307\u5b9a\u7684\u3002\u4f46\u662f\u5982\u679c\u6211\u4eec\u4f7f\u7528\u6d4f\u89c8\u5668\uff08\u6bd4\u5982chrome)\u7684\u4efb\u52a1\u7ba1\u7406\u5668\u67e5\u770b\u8fd9\u4e2a\u7a97\u53e3\u7684\u5360\u7528\u5185\u5b58\u65f6\u5c31\u4f1a\u53d1\u73b0\uff0c\u5b9e\u9645\u5360\u7528\u5e76\u4e0d\u4f1a\u8fd9\u4e48\u5927\u3002<\/p>\n<p>\u5728\u6211\u7684\u7406\u89e3\u4e2d\uff08\u5e76\u4e0d\u4e00\u5b9a\u6b63\u786e\uff09\uff0c\u8fd9\u548cC\u8bed\u8a00\u7684<code>malloc<\/code>\u7c7b\u4f3c\u3002<code>malloc<\/code>\u53ef\u4ee5\u7533\u8bf7\u5927\u4e8e\u7269\u7406\u5185\u5b58\u7684\u865a\u62df\u5185\u5b58\uff0c\u4f46\u662f\u53ea\u8981\u4f60\u4e0d\u5b9e\u9645\u5360\u7528\u8fd9\u4e48\u5927\u5185\u5b58\uff0c\u662f\u4e0d\u4f1a\u6709\u95ee\u9898\u7684\u3002\u6240\u4ee5\u867d\u7136go WebAssembly\u6253\u5370\u51fa\u6765\u67091G\u7684\u521d\u59cb\u5316\u5185\u5b58\uff0c\u4f46\u662f\u5982\u679c\u4e0d\u662f\u771f\u7684\u4f1a\u4f7f\u7528\uff0c\u662f\u4e0d\u4f1a\u5360\u7528\u8fd9\u4e48\u5927\u7269\u7406\u5185\u5b58\u7684\u3002<\/p>\n<p>\u5173\u4e8e\u521d\u59cb\u5316\u5185\u5b58\u8fc7\u5927\u7684\u95ee\u9898\uff0c\u53ef\u4ee5\u53c2\u8003\u8fd9\u4e2aissues:<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/github.com\/golang\/go\/issues\/27462\">cmd\/compile: wasm code causes out of memory error on Chrome and Firefox for Android<\/a><\/p>\n<p>\u4e00\u4e9b\u5173\u4e8eWebAssembly\u5185\u5b58\u7684\u8bbe\u8ba1\uff1a<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/github.com\/WebAssembly\/design\/blob\/master\/FutureFeatures.md#finer-grained-control-over-memory\">Finer-grained control over memory<\/a><\/p>\n<h2>\u4e00\u4e2a\u7528go WebAssembly\u5b9e\u73b0\u4e2d\u4f4d\u5207\u5206\u6cd5\u5904\u7406\u56fe\u7247\u7684\u4f8b\u5b50<\/h2>\n<p>\u5173\u4e8e\u4e2d\u5207\u5206\u6cd5\u53ef\u4ee5\u53c2\u8003\u6211\u4e4b\u524d\u7684\u8fd9\u7bc7\u6587\u7ae0\uff1a<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.myway5.com\/index.php\/2018\/12\/06\/%E4%B8%AD%E4%BD%8D%E5%88%87%E5%88%86%E6%B3%95%E9%A2%9C%E8%89%B2%E9%87%8F%E5%8C%96\/\">\u4e2d\u4f4d\u5207\u5206\u6cd5\u989c\u8272\u91cf\u5316<\/a><\/p>\n<p>\u53ef\u4ee5\u5728\u8fd9\u4e2a\u5730\u5740\u8fdb\u884c\u9884\u89c8: <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/joyme123.github.io\/WebAssembly-MedianCut\/\">\u9884\u89c8\u5730\u5740<\/a><\/p>\n<p>\u5728\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\u7684\u6548\u679c(\u8fd9\u91cc\u53ea\u5c55\u793a\u4e86FastMap\u7684\u6548\u679c\uff0cBestMap\u4f1a\u597d\u5f88\u591a\uff09\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png\" alt=\"fastmap\" \/><\/p>\n<p>\u4ee3\u7801\u7684github\u5730\u5740\u662f:<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/github.com\/joyme123\/WebAssembly-MedianCut\">WebAssembly-MedianCut<\/a><\/p>\n<p>\u91cc\u9762\u5927\u591a\u6570\u7684\u4ee3\u7801\u90fd\u662f\u7528\u7684\u6211\u4e4b\u524d\u7684\u4ee3\u7801\u3002\u53ef\u89c1go WebAssembly\u8fd8\u53ef\u4ee5\u975e\u5e38\u8212\u670d\u7684\u590d\u7528\u4e4b\u524d\u7684\u4ee3\u7801\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WebAssembly\u662f\u4e00\u95e8\u65b0\u7684\u6d4f\u89c8\u5668\u6280\u672f\u3002\u53ef\u4ee5\u53d6\u4ee3\u4e00\u90e8\u5206js\u7684\u89d2\u8272\uff0c\u5e76\u4e14\u4ece\u6027\u80fd\u4e0a\u6765\u8bf4\uff0c\u8981\u6bd4js\u597d\u5f88\u591a\u3002Web &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">go WebAssembly\u521d\u4f53\u9a8c<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[77,78],"class_list":["post-385","post","type-post","status-publish","format-standard","hentry","category-go","tag-go","tag-webassembly"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>go WebAssembly\u521d\u4f53\u9a8c - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"go WebAssembly\u521d\u4f53\u9a8c - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"WebAssembly\u662f\u4e00\u95e8\u65b0\u7684\u6d4f\u89c8\u5668\u6280\u672f\u3002\u53ef\u4ee5\u53d6\u4ee3\u4e00\u90e8\u5206js\u7684\u89d2\u8272\uff0c\u5e76\u4e14\u4ece\u6027\u80fd\u4e0a\u6765\u8bf4\uff0c\u8981\u6bd4js\u597d\u5f88\u591a\u3002Web &hellip; \u7ee7\u7eed\u9605\u8bfbgo WebAssembly\u521d\u4f53\u9a8c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-13T13:10:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-05T13:43:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"go WebAssembly\u521d\u4f53\u9a8c\",\"datePublished\":\"2018-12-13T13:10:07+00:00\",\"dateModified\":\"2023-07-05T13:43:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/\"},\"wordCount\":100,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png\",\"keywords\":[\"go\",\"WebAssembly\"],\"articleSection\":[\"go\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/\",\"name\":\"go WebAssembly\u521d\u4f53\u9a8c - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png\",\"datePublished\":\"2018-12-13T13:10:07+00:00\",\"dateModified\":\"2023-07-05T13:43:07+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#primaryimage\",\"url\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png\",\"contentUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png\",\"width\":1082,\"height\":759},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"go WebAssembly\u521d\u4f53\u9a8c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"go WebAssembly\u521d\u4f53\u9a8c - \u4e00\u53ea\u5b89\u9759\u7684\u732b","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/","og_locale":"zh_CN","og_type":"article","og_title":"go WebAssembly\u521d\u4f53\u9a8c - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"WebAssembly\u662f\u4e00\u95e8\u65b0\u7684\u6d4f\u89c8\u5668\u6280\u672f\u3002\u53ef\u4ee5\u53d6\u4ee3\u4e00\u90e8\u5206js\u7684\u89d2\u8272\uff0c\u5e76\u4e14\u4ece\u6027\u80fd\u4e0a\u6765\u8bf4\uff0c\u8981\u6bd4js\u597d\u5f88\u591a\u3002Web &hellip; \u7ee7\u7eed\u9605\u8bfbgo WebAssembly\u521d\u4f53\u9a8c","og_url":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2018-12-13T13:10:07+00:00","article_modified_time":"2023-07-05T13:43:07+00:00","og_image":[{"url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png","type":"","width":"","height":""}],"author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"go WebAssembly\u521d\u4f53\u9a8c","datePublished":"2018-12-13T13:10:07+00:00","dateModified":"2023-07-05T13:43:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/"},"wordCount":100,"commentCount":0,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png","keywords":["go","WebAssembly"],"articleSection":["go"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/","url":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/","name":"go WebAssembly\u521d\u4f53\u9a8c - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#primaryimage"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png","datePublished":"2018-12-13T13:10:07+00:00","dateModified":"2023-07-05T13:43:07+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#primaryimage","url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png","contentUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2018\/12\/go_wsam.png","width":1082,"height":759},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2018\/12\/13\/go-webassembly\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"go WebAssembly\u521d\u4f53\u9a8c"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":5827,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=385"}],"version-history":[{"count":2,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/385\/revisions"}],"predecessor-version":[{"id":1579,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/385\/revisions\/1579"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}