{"id":13174,"date":"2026-03-16T18:42:41","date_gmt":"2026-03-16T18:42:41","guid":{"rendered":"https:\/\/withcode.tech\/media\/?p=13174"},"modified":"2026-07-01T15:28:36","modified_gmt":"2026-07-01T15:28:36","slug":"web-workers-task-offload","status":"publish","type":"post","link":"https:\/\/withcode.tech\/media\/web-workers-task-offload\/","title":{"rendered":"Web Workers\u3067\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3092\u30d6\u30ed\u30c3\u30af\u3057\u306a\u3044\u30bf\u30b9\u30af\u30aa\u30d5\u30ed\u30fc\u30c9\u3010\u5b8c\u5168\u30ac\u30a4\u30c9\u3011\uff5cpostMessage\u30fbComlink\u30fbINP\u6539\u5584\u3092\u5fb9\u5e95\u89e3\u8aac"},"content":{"rendered":"\n<div class=\"wp-block-group swl-box\"><div class=\"wp-block-group__inner-container\">\n\n<h3 class=\"wp-block-heading\">\u3053\u306e\u8a18\u4e8b\u3067\u308f\u304b\u308b\u3053\u3068<\/h3>\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u308b\u539f\u56e0\u3068 Core Web Vitals\uff08INP\u30fbLCP\u30fbTBT\uff09\u3078\u306e\u5f71\u97ff<\/li>\n<li>postMessage \u306b\u3088\u308b Worker \u57fa\u672c\u901a\u4fe1\u3068 CSV \u30d1\u30fc\u30b9\u306e\u30aa\u30d5\u30ed\u30fc\u30c9\u5b9f\u88c5<\/li>\n<li>TransferableObjects\uff08\u30bc\u30ed\u30b3\u30d4\u30fc\u8ee2\u9001\uff09\u3067\u5927\u304d\u306a\u30c7\u30fc\u30bf\u3092\u9ad8\u901f\u306b\u6e21\u3059\u65b9\u6cd5<\/li>\n<li>Comlink \u30e9\u30a4\u30d6\u30e9\u30ea\u3067 Worker \u3092\u901a\u5e38\u306e async \u95a2\u6570\u306e\u3088\u3046\u306b\u547c\u3073\u51fa\u3059\u65b9\u6cd5<\/li>\n<li>Worker Pool\u30fbReact \u30ab\u30b9\u30bf\u30e0 Hook\u30fbOMT \u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306e\u5b9f\u8df5\u30d1\u30bf\u30fc\u30f3<\/li>\n<\/ul>\n\n<\/div><\/div>\n\n\n<div class=\"swell-block-balloon\"><div class=\"c-balloon -bln-left\" data-col=\"gray\"><div class=\"c-balloon__icon -square\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/withcode.tech\/media\/wp-content\/uploads\/2025\/06\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-06-15-14.48.08.jpg\" alt=\"\" class=\"c-balloon__iconImg\" width=\"80px\" height=\"80px\"><span class=\"c-balloon__iconName\">\u751f\u5f92<\/span><\/div><div class=\"c-balloon__body -speaking -border-none\"><div class=\"c-balloon__text\">\n<p><strong>\u91cd\u3044\u8a08\u7b97\u51e6\u7406\u3092\u3059\u308b\u3068UI\u304c\u30d5\u30ea\u30fc\u30ba\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u30b9\u30af\u30ed\u30fc\u30eb\u3082\u6b62\u307e\u3063\u3066\u6700\u60aa\u306a\u3093\u3067\u3059\u304c\u2026\u2026<\/strong><\/p>\n<span class=\"c-balloon__shapes\"><span class=\"c-balloon__before\"><\/span><span class=\"c-balloon__after\"><\/span><\/span><\/div><\/div><\/div><\/div>\n\n<div class=\"swell-block-balloon\"><div class=\"c-balloon -bln-right\" data-col=\"gray\"><div class=\"c-balloon__icon -square\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/withcode.tech\/media\/wp-content\/uploads\/2025\/06\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-06-15-15.11.23.jpg\" alt=\"\" class=\"c-balloon__iconImg\" width=\"80px\" height=\"80px\"><span class=\"c-balloon__iconName\">\u30da\u30f3\u535a\u58eb<\/span><\/div><div class=\"c-balloon__body -speaking -border-none\"><div class=\"c-balloon__text\">\n<p><strong>\u305d\u308c\u306f\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u3066\u3044\u308b\u3093\u3058\u3083\uff01Web Workers\u3092\u4f7f\u3048\u3070\u91cd\u3044\u51e6\u7406\u3092\u5225\u30b9\u30ec\u30c3\u30c9\u306b\u79fb\u3057\u3066UI\u3092\u30d5\u30ea\u30fc\u30ba\u3055\u305b\u306a\u304f\u3067\u304d\u308b\u305e\u3002Core Web Vitals\u306eINP\u3084LCP\u306e\u6539\u5584\u306b\u3082\u76f4\u7d50\u3059\u308b\u304b\u3089\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u672c\u6c17\u3067\u4e0a\u3052\u305f\u3044\u306a\u3089\u5fc5\u9808\u306e\u6280\u8853\u3058\u3083\uff01<\/strong><\/p>\n<span class=\"c-balloon__shapes\"><span class=\"c-balloon__before\"><\/span><span class=\"c-balloon__after\"><\/span><\/span><\/div><\/div><\/div><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001Web Workers \u306f\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3092\u30d6\u30ed\u30c3\u30af\u3059\u308b\u91cd\u3044\u51e6\u7406\u3092\u5225\u30b9\u30ec\u30c3\u30c9\u306b\u79fb\u3059\u3053\u3068\u3067 UI \u306e\u30d5\u30ea\u30fc\u30ba\u3092\u9632\u304e\u3001Core Web Vitals\uff08INP\u30fbLCP\u30fbTBT\uff09\u3092\u76f4\u63a5\u6539\u5584\u3057\u307e\u3059\u3002<\/strong>postMessage \u2192 TransferableObjects \u2192 Comlink \u306e\u9806\u306b\u5c0e\u5165\u96e3\u6613\u5ea6\u304c\u4e0a\u304c\u308a\u307e\u3059\u304c\u3001\u3069\u308c\u3082\u6bb5\u968e\u7684\u306b\u5c0e\u5165\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u672c\u8a18\u4e8b\u3067\u306f\u3001<strong><span class=\"swl-marker mark_yellow\">Web Workers \u306e\u4ed5\u7d44\u307f\u30fbpostMessage \u306b\u3088\u308b\u901a\u4fe1\u30fbTransferableObjects \u306b\u3088\u308b\u30bc\u30ed\u30b3\u30d4\u30fc\u8ee2\u9001\u30fbComlink \u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u6d3b\u7528\u30fbWorker Pool\u30fbINP\/LCP \u3078\u306e\u5f71\u97ff\u30fbOMT \u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u30fbReact\/TypeScript \u3067\u306e\u5b9f\u8df5\u30d1\u30bf\u30fc\u30f3<\/span><\/strong>\u3092\u5b8c\u5168\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n<p><strong>\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044\uff1a<\/strong><br>\n<a href=\"https:\/\/withcode.tech\/media\/\">WebAssembly\uff08Wasm\uff09\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u9ad8\u901f\u5316\u306e\u5b9f\u8df5\u30ac\u30a4\u30c9<\/a>\uff08\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\uff09\n<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306e\u554f\u984c\u3068 Web Workers \u306e\u5f79\u5272<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u30d6\u30e9\u30a6\u30b6\u306f1\u3064\u306e\u30bf\u30d6\u306b\u5bfe\u3057\u3066\u57fa\u672c\u7684\u306b1\u3064\u306e\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3092\u6301\u3061\u307e\u3059\u3002\u3053\u306e\u30b9\u30ec\u30c3\u30c9\u306f<strong>JavaScript \u306e\u5b9f\u884c\u30fbDOM \u306e\u66f4\u65b0\u30fb\u30ec\u30a4\u30a2\u30a6\u30c8\u8a08\u7b97\u30fb\u30da\u30a4\u30f3\u30c8<\/strong>\u3092\u3059\u3079\u3066\u62c5\u5f53\u3057\u307e\u3059\u3002\u91cd\u3044\u51e6\u7406\u304c\u8d70\u308b\u3068\u3053\u308c\u3089\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u3001UI \u304c\u30d5\u30ea\u30fc\u30ba\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4eba\u9593\u304c UI \u306e\u300c\u9045\u3055\u300d\u3092\u611f\u3058\u308b\u95be\u5024\u306f\u7d04 100ms \u3068\u8a00\u308f\u308c\u3066\u3044\u307e\u3059\u3002\u4e00\u65b9\u3001JavaScript \u30671\u4e07\u4ef6\u306e\u30c7\u30fc\u30bf\u3092\u30bd\u30fc\u30c8\u3059\u308b\u3068\u6570\u5341\u301c\u6570\u767ems \u304b\u304b\u308a\u307e\u3059\u300250MB \u306e CSV \u30d5\u30a1\u30a4\u30eb\u3092\u30d1\u30fc\u30b9\u3059\u308b\u30681\u301c3\u79d2\u30d6\u30ed\u30c3\u30af\u3055\u308c\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<strong>Web Workers \u306f\u3053\u306e\u554f\u984c\u3092\u6839\u672c\u304b\u3089\u89e3\u6c7a\u3059\u308b\u300c\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u300d\u306e\u4ed5\u7d44\u307f<\/strong>\u3067\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full\"><img decoding=\"async\" src=\"img\/web_workers_overview.png\" alt=\"\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3068Web Worker\u30b9\u30ec\u30c3\u30c9\u306e\u5206\u96e2\u3092\u793a\u3059\u69cb\u6210\u56f3\" class=\"wp-image-12490\"\/><\/figure>\n<\/div>\n\n\n<pre class=\"wp-block-code\"><code>>\u3010\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u308b\u5178\u578b\u7684\u306a\u30b1\u30fc\u30b9\u3011\n\n\u274c \u5927\u91cf\u30c7\u30fc\u30bf\u306e\u51e6\u7406\uff08CSV\u30d1\u30fc\u30b9\u30fbJSON\u306e\u89e3\u6790\uff09\n\u274c \u8907\u96d1\u306a\u6570\u5024\u8a08\u7b97\uff08\u7269\u7406\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u30fb\u6a5f\u68b0\u5b66\u7fd2\u306e\u63a8\u8ad6\uff09\n\u274c \u753b\u50cf\u51e6\u7406\uff08\u30d5\u30a3\u30eb\u30bf\u30fc\u9069\u7528\u30fb\u30ea\u30b5\u30a4\u30ba\u30fb\u30ab\u30e9\u30fc\u5909\u63db\uff09\n\u274c \u6697\u53f7\u5316\u30fb\u30cf\u30c3\u30b7\u30e5\u8a08\u7b97\n\u274c \u5927\u304d\u306a\u30c7\u30fc\u30bf\u306e\u4e26\u3073\u66ff\u3048\u30fb\u691c\u7d22\n\u274c Zip\/Gzip\u306e\u5727\u7e2e\u30fb\u89e3\u51cd\u51e6\u7406\n\u274c \u30c6\u30ad\u30b9\u30c8\u306e\u5168\u6587\u691c\u7d22\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u69cb\u7bc9\n\n\u2192 \u3053\u308c\u3089\u3092\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3067\u5b9f\u884c\u3059\u308b\u3068\uff1a\n  - \u30b9\u30af\u30ed\u30fc\u30eb\u304c\u6b62\u307e\u308b\n  - \u30dc\u30bf\u30f3\u304c\u53cd\u5fdc\u3057\u306a\u3044\n  - \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u30ab\u30af\u3064\u304f\n  - Core Web Vitals\uff08INP\u30fbLCP\uff09\u304c\u60aa\u5316\u3059\u308b<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Web Workers \u3068 Core Web Vitals \u306e\u95a2\u4fc2<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u6307\u6a19<\/th><th>\u8aac\u660e<\/th><th>Web Workers \u5c0e\u5165\u524d<\/th><th>Web Workers \u5c0e\u5165\u5f8c<\/th><\/tr><\/thead><tbody><tr><td><strong>INP\uff08Interaction to Next Paint\uff09<\/strong><\/td><td>\u64cd\u4f5c\u5f8c\u306e\u6b21\u306e\u30da\u30a4\u30f3\u30c8\u307e\u3067\u306e\u6642\u9593<\/td><td>\u91cd\u3044\u51e6\u7406\u4e2d\u306f\u30e6\u30fc\u30b6\u30fc\u64cd\u4f5c\u3078\u306e\u5fdc\u7b54\u304c\u9045\u5ef6\uff08200ms \u8d85\uff09<\/td><td>\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u304c\u7a7a\u304f\u305f\u3081\u5373\u5ea7\u306b\u5fdc\u7b54\uff0850ms \u4ee5\u4e0b\uff09<\/td><\/tr><tr><td><strong>LCP\uff08Largest Contentful Paint\uff09<\/strong><\/td><td>\u6700\u5927\u30b3\u30f3\u30c6\u30f3\u30c4\u63cf\u753b\u6642\u9593<\/td><td>\u8d77\u52d5\u6642\u306e\u91cd\u3044\u51e6\u7406\u304c LCP \u3092\u30d6\u30ed\u30c3\u30af<\/td><td>\u8d77\u52d5\u6642\u306e\u91cd\u3044\u51e6\u7406\u3092 Worker \u306b\u79fb\u3057\u3066 LCP \u6539\u5584<\/td><\/tr><tr><td><strong>TBT\uff08Total Blocking Time\uff09<\/strong><\/td><td>\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306e\u30d6\u30ed\u30c3\u30af\u5408\u8a08\u6642\u9593<\/td><td>\u9577\u3044\u51e6\u7406\u30bf\u30b9\u30af\u304c\u7a4d\u307f\u91cd\u306a\u308b<\/td><td>Worker \u3078\u306e\u30aa\u30d5\u30ed\u30fc\u30c9\u3067\u30bf\u30b9\u30af\u6642\u9593\u3092 50ms \u4ee5\u4e0b\u306b<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Google \u306e\u30e9\u30f3\u30ad\u30f3\u30b0\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u306f Core Web Vitals \u304c\u76f4\u63a5\u5f71\u97ff\u3057\u307e\u3059\u3002\u7279\u306b INP\uff08Interaction to Next Paint\uff09\u306f 2024\u5e743\u6708\u306b FID \u306b\u66ff\u308f\u308b\u65b0\u3057\u3044\u6307\u6a19\u3068\u3057\u3066\u6b63\u5f0f\u63a1\u7528\u3055\u308c\u3066\u304a\u308a\u3001Web \u30a2\u30d7\u30ea\u306e\u5fdc\u7b54\u6027\u6539\u5584\u306f SEO \u306b\u3082\u76f4\u7d50\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Web Workers \u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\uff5cpostMessage \u306b\u3088\u308b\u901a\u4fe1<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u57fa\u672c\uff1aWorker \u306e\u4f5c\u6210\u3068\u30e1\u30c3\u30bb\u30fc\u30b8\u901a\u4fe1<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ main.js - \u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u5074\nconst worker = new Worker('.\/worker.js')\n\n\/\/ Worker\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u308b\nworker.postMessage({ type: 'CALCULATE', data: [1, 2, 3, 4, 5] })\n\n\/\/ Worker\u304b\u3089\u306e\u7d50\u679c\u3092\u53d7\u3051\u53d6\u308b\nworker.addEventListener('message', (event) => {\n  console.log('\u8a08\u7b97\u7d50\u679c:', event.data)  \/\/ \u2192 { result: 15 }\n})\n\n\/\/ \u30a8\u30e9\u30fc\u51e6\u7406\nworker.addEventListener('error', (error) => {\n  console.error('Worker \u30a8\u30e9\u30fc:', error.message)\n})\n\n\/\/ Worker\u3092\u7d42\u4e86\u3059\u308b\uff08\u4e0d\u8981\u306b\u306a\u3063\u305f\u3089\u5fc5\u305a\u7834\u68c4\u3059\u308b\uff09\n\/\/ worker.terminate()<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ worker.js - Worker\u30b9\u30ec\u30c3\u30c9\u5074\n\/\/ \u26a0\ufe0f Worker\u3067\u306fDOM\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u306a\u3044\uff08document\/window\u306f\u4f7f\u3048\u306a\u3044\uff09\n\/\/ \u2705 fetch\u30fbIndexedDB\u30fbWebSocket\u30fbsetTimeout\u7b49\u306f\u4f7f\u3048\u308b\n\naddEventListener('message', (event) => {\n  const { type, data } = event.data\n\n  switch (type) {\n    case 'CALCULATE': {\n      \/\/ \u91cd\u3044\u8a08\u7b97\u51e6\u7406\uff08\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3092\u30d6\u30ed\u30c3\u30af\u3057\u306a\u3044\uff09\n      const result = data.reduce((sum, n) => sum + n, 0)\n      \/\/ \u7d50\u679c\u3092\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306b\u8fd4\u3059\n      postMessage({ type: 'RESULT', result })\n      break\n    }\n    case 'SORT': {\n      const sorted = [...data].sort((a, b) => a - b)\n      postMessage({ type: 'SORTED', result: sorted })\n      break\n    }\n  }\n})<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9f\u8df5\uff1a\u5927\u91cf CSV \u30c7\u30fc\u30bf\u306e\u30d1\u30fc\u30b9\u51e6\u7406\u3092\u30aa\u30d5\u30ed\u30fc\u30c9<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ csv-worker.js\naddEventListener('message', (event) => {\n  const { csvText } = event.data\n\n  \/\/ \u5927\u91cf\u30c7\u30fc\u30bf\u306e\u30d1\u30fc\u30b9\uff08\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3092\u30d6\u30ed\u30c3\u30af\u3057\u306a\u3044\uff09\n  const lines = csvText.split('\\n')\n  const headers = lines[0].split(',')\n  const records = lines.slice(1)\n    .filter(line => line.trim())  \/\/ \u7a7a\u884c\u3092\u9664\u5916\n    .map(line => {\n      const values = line.split(',')\n      return headers.reduce((obj, header, i) => {\n        obj[header.trim()] = values[i]?.trim() ?? ''\n        return obj\n      }, {})\n    })\n\n  \/\/ \u51e6\u7406\u5b8c\u4e86\u3092\u901a\u77e5\n  postMessage({ records, count: records.length })\n})<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ main.js - CSV\u30d5\u30a1\u30a4\u30eb\u3092Worker\u3067\u51e6\u7406\u3059\u308b\nconst csvWorker = new Worker('.\/csv-worker.js')\n\nasync function handleFileUpload(file) {\n  const text = await file.text()\n\n  \/\/ UI\u306f\u7d99\u7d9a\u3057\u3066\u5fdc\u7b54\u3059\u308b\uff08\u30b9\u30d4\u30ca\u30fc\u3092\u8868\u793a\u3057\u306a\u304c\u3089\u5f85\u3066\u308b\uff09\n  showLoadingSpinner()\n\n  csvWorker.postMessage({ csvText: text })\n\n  csvWorker.addEventListener('message', (event) => {\n    hideLoadingSpinner()\n    const { records, count } = event.data\n    console.log(`${count}\u4ef6\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u30d1\u30fc\u30b9\u3057\u307e\u3057\u305f`)\n    renderTable(records)\n  }, { once: true })  \/\/ \u4e00\u5ea6\u3060\u3051\u53d7\u3051\u53d6\u3063\u305f\u3089\u30ea\u30b9\u30ca\u30fc\u3092\u524a\u9664\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">TransferableObjects\uff5c\u30bc\u30ed\u30b3\u30d4\u30fc\u3067\u5927\u304d\u306a\u30c7\u30fc\u30bf\u3092\u8ee2\u9001\u3059\u308b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u30c7\u30d5\u30a9\u30eb\u30c8\u306e <code>postMessage<\/code> \u3067\u306f\u30c7\u30fc\u30bf\u306f<strong>\u30b3\u30d4\u30fc\u3055\u308c\u3066<\/strong>\u6e21\u3055\u308c\u307e\u3059\u3002100MB \u306e\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u30b3\u30d4\u30fc\u8ee2\u9001\u3059\u308b\u3068\u3001\u30e1\u30e2\u30ea\u3092 200MB \u6d88\u8cbb\u3057\u305f\u4e0a\u306b\u8ee2\u9001\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u3002<strong>TransferableObjects \u3092\u4f7f\u3046\u3068\u6240\u6709\u6a29\u306e\u79fb\u8ee2\uff08\u30bc\u30ed\u30b3\u30d4\u30fc\uff09\u3067\u9ad8\u901f\u304b\u3064\u30e1\u30e2\u30ea\u52b9\u7387\u3088\u304f\u30c7\u30fc\u30bf\u3092\u6e21\u305b\u307e\u3059<\/strong>\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u8ee2\u9001\u65b9\u5f0f<\/th><th>\u4ed5\u7d44\u307f<\/th><th>\u901f\u5ea6<\/th><th>\u5143\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/th><\/tr><\/thead><tbody><tr><td><strong>\u30b3\u30d4\u30fc\u8ee2\u9001\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\uff09<\/strong><\/td><td>\u30c7\u30fc\u30bf\u3092\u8907\u88fd\u3057\u3066\u304b\u3089\u6e21\u3059<\/td><td>\u30c7\u30fc\u30bf\u30b5\u30a4\u30ba\u306b\u6bd4\u4f8b\u3057\u3066\u9045\u304f\u306a\u308b<\/td><td>\u5143\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u305d\u306e\u307e\u307e\u4f7f\u3048\u308b<\/td><\/tr><tr><td><strong>Transferable\uff08\u6240\u6709\u6a29\u79fb\u8ee2\uff09<\/strong><\/td><td>\u30e1\u30e2\u30ea\u306e\u6240\u6709\u6a29\u3054\u3068\u79fb\u8ee2\u3059\u308b<\/td><td>\u30c7\u30fc\u30bf\u30b5\u30a4\u30ba\u306b\u95a2\u308f\u3089\u305a\u9ad8\u901f<\/td><td>\u79fb\u8ee2\u5f8c\u306f\u5143\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u4f7f\u3048\u306a\u304f\u306a\u308b<\/td><\/tr><tr><td><strong>SharedArrayBuffer\uff08\u5171\u6709\uff09<\/strong><\/td><td>\u30e1\u30e2\u30ea\u3092\u5171\u6709\u3059\u308b<\/td><td>\u6700\u901f\uff08\u30b3\u30d4\u30fc\u306a\u3057\u30fb\u79fb\u8ee2\u306a\u3057\uff09<\/td><td>\u4e21\u65b9\u304b\u3089\u53c2\u7167\u30fb\u5909\u66f4\u53ef\u80fd<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ transferable_example.js - TransferableObjects\u306e\u4f7f\u3044\u65b9\n\n\/\/ \u274c \u9045\u3044\uff1a100MB\u306eArrayBuffer\u3092\u30b3\u30d4\u30fc\u3057\u3066\u8ee2\u9001\uff08\u5408\u8a08200MB\u4f7f\u7528\uff09\nconst bigBuffer = new ArrayBuffer(100 * 1024 * 1024)  \/\/ 100MB\nworker.postMessage({ buffer: bigBuffer })  \/\/ \u30b3\u30d4\u30fc\u3055\u308c\u308b\n\n\/\/ \u2705 \u901f\u3044\uff1aArrayBuffer\u306e\u6240\u6709\u6a29\u3092\u79fb\u8ee2\uff08\u30b3\u30d4\u30fc\u306a\u3057\u3001\u30e1\u30e2\u30ea\u52b9\u7387\u25ce\uff09\nconst bigBuffer2 = new ArrayBuffer(100 * 1024 * 1024)  \/\/ 100MB\nworker.postMessage(\n  { buffer: bigBuffer2 },\n  [bigBuffer2]  \/\/ \u7b2c2\u5f15\u6570\u306bTransfer\u30ea\u30b9\u30c8\u3092\u6307\u5b9a\n)\n\/\/ \u26a0\ufe0f \u79fb\u8ee2\u5f8c\u306f bigBuffer2 \u306f\u4f7f\u3048\u306a\u304f\u306a\u308b\uff08detached\u72b6\u614b\uff09\nconsole.log(bigBuffer2.byteLength)  \/\/ \u2192 0\uff08\u7a7a\u306b\u306a\u3063\u3066\u3044\u308b\uff09\n\n\/\/ Transferable\u3068\u3057\u3066\u4f7f\u3048\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff1a\n\/\/ - ArrayBuffer\n\/\/ - MessagePort\n\/\/ - ReadableStream \/ WritableStream \/ TransformStream\n\/\/ - ImageBitmap\n\/\/ - OffscreenCanvas<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9f\u8df5\uff1aImageData \u3092 Transferable \u3067\u9ad8\u901f\u8ee2\u9001<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ image-worker.js - \u753b\u50cf\u51e6\u7406Worker\u3067\u306e\u53cc\u65b9\u5411Transferable\u6d3b\u7528\n\naddEventListener('message', (event) => {\n  const { buffer, width, height, filter } = event.data\n  const data = new Uint8ClampedArray(buffer)\n\n  \/\/ \u30d5\u30a3\u30eb\u30bf\u30fc\u51e6\u7406\n  if (filter === 'grayscale') {\n    for (let i = 0; i < data.length; i += 4) {\n      const avg = (data[i] + data[i+1] + data[i+2]) \/ 3\n      data[i] = data[i+1] = data[i+2] = avg\n    }\n  }\n\n  \/\/ \u51e6\u7406\u6e08\u307f\u30d0\u30c3\u30d5\u30a1\u3092\u6240\u6709\u6a29\u79fb\u8ee2\u3067\u8fd4\u3059\uff08\u30b3\u30d4\u30fc\u306a\u3057\uff09\n  postMessage(\n    { buffer, width, height },\n    [buffer]  \/\/ \u6240\u6709\u6a29\u3092\u79fb\u8ee2\u3057\u3066\u8fd4\u3059\n  )\n})<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ main.js - Canvas\u753b\u50cf\u3092Worker\u3067\u51e6\u7406\u3059\u308b\u9ad8\u901f\u7248\n\nconst imageWorker = new Worker('.\/image-worker.js', { type: 'module' })\n\nasync function applyFilterFast(canvas, filter) {\n  const ctx = canvas.getContext('2d')\n  const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height)\n\n  \/\/ ImageData.data\uff08Uint8ClampedArray\uff09\u306ebuffer\u3092Transferable\u3067\u9001\u308b\n  const buffer = imageData.data.buffer\n\n  return new Promise((resolve) => {\n    imageWorker.addEventListener('message', (e) => {\n      const resultData = new Uint8ClampedArray(e.data.buffer)\n      const resultImageData = new ImageData(resultData, canvas.width, canvas.height)\n      ctx.putImageData(resultImageData, 0, 0)\n      resolve()\n    }, { once: true })\n\n    imageWorker.postMessage(\n      { buffer, width: canvas.width, height: canvas.height, filter },\n      [buffer]  \/\/ \u30d0\u30c3\u30d5\u30a1\u306e\u6240\u6709\u6a29\u3092\u79fb\u8ee2\n    )\n  })\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Comlink\uff1apostMessage \u3092\u3082\u3063\u3068\u7c21\u5358\u306b\u3059\u308b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u751f\u306e <code>postMessage<\/code> API \u306f\u3001\u8907\u6570\u306e\u51e6\u7406\u30bf\u30a4\u30d7\u3092\u6271\u3046\u3068\u30b3\u30fc\u30c9\u304c\u8907\u96d1\u306b\u306a\u308a\u307e\u3059\u3002<strong>Comlink<\/strong> \u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046\u3068\u3001Worker \u306e\u95a2\u6570\u3092\u901a\u5e38\u306e\u975e\u540c\u671f\u95a2\u6570\u306e\u3088\u3046\u306b\u547c\u3073\u51fa\u305b\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>>npm install comlink<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ heavy-worker.ts - Comlink \u3067 Worker \u306e\u95a2\u6570\u3092\u516c\u958b\u3059\u308b\nimport { expose } from 'comlink'\n\nconst api = {\n  \/\/ \u91cd\u3044\u753b\u50cf\u30d5\u30a3\u30eb\u30bf\u30fc\u51e6\u7406\n  async applyGrayscale(imageData: ImageData): Promise<ImageData> {\n    const data = imageData.data\n    for (let i = 0; i < data.length; i += 4) {\n      const avg = (data[i] + data[i+1] + data[i+2]) \/ 3\n      data[i] = data[i+1] = data[i+2] = avg\n    }\n    return imageData\n  },\n\n  \/\/ \u5927\u898f\u6a21\u306a\u30bd\u30fc\u30c8\u51e6\u7406\n  async sortLargeArray(arr: number[]): Promise<number[]> {\n    return arr.sort((a, b) => a - b)\n  },\n\n  \/\/ \u30cf\u30c3\u30b7\u30e5\u8a08\u7b97\uff08Web Crypto API \u306fWorker\u3067\u3082\u4f7f\u3048\u308b\uff09\n  async computeHash(text: string): Promise<string> {\n    const encoder = new TextEncoder()\n    const data = encoder.encode(text)\n    const hashBuffer = await crypto.subtle.digest('SHA-256', data)\n    const hashArray = Array.from(new Uint8Array(hashBuffer))\n    return hashArray.map(b => b.toString(16).padStart(2, '0')).join('')\n  },\n\n  \/\/ \u30d7\u30ed\u30b0\u30ec\u30b9\u4ed8\u304d\u91cd\u3044\u51e6\u7406\uff08\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u6e21\u3059\u4f8b\uff09\n  async processWithProgress(\n    data: number[],\n    onProgress: (percent: number) => void\n  ): Promise<number[]> {\n    const result = []\n    for (let i = 0; i < data.length; i++) {\n      result.push(data[i] * 2)  \/\/ \u91cd\u3044\u51e6\u7406\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\n      if (i % 1000 === 0) {\n        onProgress(Math.floor((i \/ data.length) * 100))\n      }\n    }\n    return result\n  }\n}\n\nexpose(api)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ main.ts - Comlink \u3067 Worker \u3092\u901a\u5e38\u306e\u95a2\u6570\u306e\u3088\u3046\u306b\u547c\u3073\u51fa\u3059\nimport { wrap, proxy } from 'comlink'\nimport type { Remote } from 'comlink'\n\n\/\/ Worker \u306e\u578b\ntype WorkerAPI = typeof import('.\/heavy-worker').api\n\nconst worker = new Worker(new URL('.\/heavy-worker.ts', import.meta.url), {\n  type: 'module'\n})\nconst api: Remote<WorkerAPI> = wrap<WorkerAPI>(worker)\n\n\/\/ async\/await \u3067 Worker \u306e\u95a2\u6570\u3092\u76f4\u63a5\u547c\u3073\u51fa\u305b\u308b\nasync function processImage(canvas: HTMLCanvasElement) {\n  const ctx = canvas.getContext('2d')!\n  const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height)\n\n  \/\/ Worker \u306b\u51e6\u7406\u3092\u30aa\u30d5\u30ed\u30fc\u30c9\uff08UI \u306f\u30d6\u30ed\u30c3\u30af\u3055\u308c\u306a\u3044\uff09\n  const processed = await api.applyGrayscale(imageData)\n  ctx.putImageData(processed, 0, 0)\n}\n\n\/\/ \u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u4ed8\u304d\u51e6\u7406\uff08Comlink \u306e proxy() \u3092\u4f7f\u3046\uff09\nasync function processWithProgress(data: number[]) {\n  const result = await api.processWithProgress(\n    data,\n    proxy((percent: number) => {\n      console.log(`\u9032\u6357: ${percent}%`)\n      updateProgressBar(percent)\n    })\n  )\n  return result\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Worker Pool\uff5c\u8907\u6570 Worker \u3067\u4e26\u5217\u51e6\u7406\u3059\u308b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">CPU \u306e\u30b3\u30a2\u6570\u306b\u5408\u308f\u305b\u3066\u8907\u6570\u306e Worker \u3092\u8d77\u52d5\u3057\u3001\u30bf\u30b9\u30af\u3092\u4e26\u5217\u51e6\u7406\u3059\u308b\u300cWorker Pool\u300d\u30d1\u30bf\u30fc\u30f3\u3092\u4f7f\u3046\u3068\u3001\u5927\u91cf\u306e\u30bf\u30b9\u30af\u3092\u3088\u308a\u9ad8\u901f\u306b\u51e6\u7406\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u753b\u50cf\u5909\u63db\u30c4\u30fc\u30eb\u3067100\u679a\u306e\u753b\u50cf\u3092\u4e00\u62ec\u51e6\u7406\u3059\u308b\u5834\u5408\u30014\u30b3\u30a2 CPU \u306b4\u3064\u306e Worker \u3092\u8d77\u52d5\u3059\u308c\u3070\u7406\u8ad6\u4e0a4\u500d\u901f\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ worker-pool.ts - \u30b7\u30f3\u30d7\u30eb\u306aWorker Pool\u5b9f\u88c5\n\nclass WorkerPool {\n  private workers: Worker[]\n  private taskQueue: Array<{\n    data: unknown\n    resolve: (result: unknown) => void\n    reject: (error: unknown) => void\n  }> = []\n  private idleWorkers: Worker[]\n\n  constructor(workerUrl: URL, poolSize: number = navigator.hardwareConcurrency) {\n    \/\/ CPU\u306e\u30b3\u30a2\u6570\u306b\u5408\u308f\u305b\u3066Worker\u3092\u8d77\u52d5\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\uff09\n    this.workers = Array.from({ length: poolSize }, () =>\n      new Worker(workerUrl, { type: 'module' })\n    )\n    this.idleWorkers = [...this.workers]\n\n    console.log(`Worker Pool: ${poolSize}\u30b9\u30ec\u30c3\u30c9\u3067\u8d77\u52d5\u3057\u307e\u3057\u305f`)\n  }\n\n  async execute(data: unknown): Promise<unknown> {\n    return new Promise((resolve, reject) => {\n      const task = { data, resolve, reject }\n\n      const idleWorker = this.idleWorkers.pop()\n      if (idleWorker) {\n        this.runTask(idleWorker, task)\n      } else {\n        \/\/ \u7a7a\u304dWorker\u304c\u306a\u3051\u308c\u3070\u30ad\u30e5\u30fc\u306b\u8ffd\u52a0\n        this.taskQueue.push(task)\n      }\n    })\n  }\n\n  private runTask(worker: Worker, task: typeof this.taskQueue[0]) {\n    const handler = (event: MessageEvent) => {\n      worker.removeEventListener('message', handler)\n      worker.removeEventListener('error', errorHandler)\n\n      task.resolve(event.data)\n\n      \/\/ \u6b21\u306e\u30bf\u30b9\u30af\u3092\u53d6\u308a\u51fa\u3057\u3066\u5b9f\u884c\n      const nextTask = this.taskQueue.shift()\n      if (nextTask) {\n        this.runTask(worker, nextTask)\n      } else {\n        this.idleWorkers.push(worker)\n      }\n    }\n\n    const errorHandler = (error: ErrorEvent) => {\n      worker.removeEventListener('message', handler)\n      worker.removeEventListener('error', errorHandler)\n      task.reject(error)\n      this.idleWorkers.push(worker)\n    }\n\n    worker.addEventListener('message', handler)\n    worker.addEventListener('error', errorHandler)\n    worker.postMessage(task.data)\n  }\n\n  terminate() {\n    this.workers.forEach(w => w.terminate())\n  }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\uff1a100\u679a\u306e\u753b\u50cf\u3092\u4e26\u5217\u51e6\u7406\nconst pool = new WorkerPool(new URL('.\/image-worker.ts', import.meta.url))\n\nconst images = getImageDataArray()  \/\/ 100\u500b\u306eImageData\nconst results = await Promise.all(\n  images.map(img => pool.execute({ imageData: img, filter: 'grayscale' }))\n)\nconsole.log(`${results.length}\u679a\u306e\u753b\u50cf\u51e6\u7406\u5b8c\u4e86`)\npool.terminate()<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">React \/ Next.js \u3067\u306e\u5b9f\u88c5\u30d1\u30bf\u30fc\u30f3<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u30ab\u30b9\u30bf\u30e0 Hook \u3067 Worker \u3092\u7ba1\u7406\u3059\u308b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ hooks\/useWorker.ts - Web Worker\u3092React Hooks\u3067\u7ba1\u7406\u3059\u308b\n\nimport { useEffect, useRef, useState, useCallback } from 'react'\n\ntype WorkerState<T> = {\n  result: T | null\n  loading: boolean\n  error: string | null\n}\n\nexport function useWorker<T = unknown>(workerUrl: URL) {\n  const workerRef = useRef<Worker | null>(null)\n  const [state, setState] = useState<WorkerState<T>>({\n    result: null,\n    loading: false,\n    error: null,\n  })\n\n  useEffect(() => {\n    workerRef.current = new Worker(workerUrl, { type: 'module' })\n\n    workerRef.current.addEventListener('message', (event: MessageEvent<T>) => {\n      setState({ result: event.data, loading: false, error: null })\n    })\n\n    workerRef.current.addEventListener('error', (error: ErrorEvent) => {\n      setState(prev => ({ ...prev, loading: false, error: error.message }))\n    })\n\n    return () => {\n      workerRef.current?.terminate()\n    }\n  }, [workerUrl])\n\n  const execute = useCallback((data: unknown) => {\n    if (!workerRef.current) return\n    setState(prev => ({ ...prev, loading: true, error: null }))\n    workerRef.current.postMessage(data)\n  }, [])\n\n  return { ...state, execute }\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ components\/DataProcessor.tsx - \u30ab\u30b9\u30bf\u30e0Hook\u3092\u4f7f\u3046\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\n'use client'\n\nimport { useWorker } from '@\/hooks\/useWorker'\nimport { useState } from 'react'\n\ntype SortResult = { sorted: number[]; time: number }\n\nexport function DataProcessor() {\n  const [inputText, setInputText] = useState('')\n  const { result, loading, error, execute } = useWorker<SortResult>(\n    new URL('..\/workers\/sort-worker.ts', import.meta.url)\n  )\n\n  const handleProcess = () => {\n    const numbers = inputText\n      .split(',')\n      .map(Number)\n      .filter(n => !isNaN(n))\n    execute({ numbers })\n  }\n\n  return (\n    <div className=\"p-4 space-y-4\">\n      <textarea\n        value={inputText}\n        onChange={(e) => setInputText(e.target.value)}\n        placeholder=\"\u30ab\u30f3\u30de\u533a\u5207\u308a\u3067\u6570\u5024\u3092\u5165\u529b\uff08\u4f8b: 3,1,4,1,5,9,2,6\uff09\"\n        className=\"w-full border rounded p-2 h-24\"\n      \/>\n      <button\n        onClick={handleProcess}\n        disabled={loading || !inputText}\n        className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n      >\n        {loading ? '\u30bd\u30fc\u30c8\u4e2d...' : 'Worker\u3067\u30bd\u30fc\u30c8'}\n      <\/button>\n\n      {error && <p className=\"text-red-500\">{error}<\/p>}\n\n      {result && (\n        <div className=\"bg-gray-50 p-3 rounded\">\n          <p className=\"text-sm text-gray-500\">\u51e6\u7406\u6642\u9593: {result.time}ms<\/p>\n          <p className=\"mt-1\">{result.sorted.slice(0, 20).join(', ')}...<\/p>\n        <\/div>\n      )}\n    <\/div>\n  )\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Vite \u3067\u306e Worker \u30a4\u30f3\u30dd\u30fc\u30c8\u8a2d\u5b9a<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ Vite\uff08Next.js \/ React\uff09\u3067\u306e Worker \u30d5\u30a1\u30a4\u30eb\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\u65b9\u6cd5\n\n\/\/ \u2705 Vite \u63a8\u5968\u306e\u66f8\u304d\u65b9\uff08import.meta.url \u3092\u4f7f\u3046\uff09\nconst worker = new Worker(new URL('.\/heavy-worker.ts', import.meta.url), {\n  type: 'module'\n})\n\n\/\/ \u2705 Vite \u306e ?worker \u30b5\u30d5\u30a3\u30c3\u30af\u30b9\u3092\u4f7f\u3046\u66f8\u304d\u65b9\nimport HeavyWorker from '.\/heavy-worker.ts?worker'\nconst worker = new HeavyWorker()\n\n\/\/ \u2705 Next.js \u3067\u306e\u66f8\u304d\u65b9\uff08package.json \u306e type: \"module\" \u304c\u5fc5\u8981\uff09\n\/\/ next.config.ts \u3067 worker \u3092\u8a2d\u5b9a\n\/\/ module.exports = { experimental: { workerThreads: true } }<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">OMT \u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\uff5cUI \u3068\u30ed\u30b8\u30c3\u30af\u3092\u5b8c\u5168\u5206\u96e2\u3059\u308b\u8a2d\u8a08<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Off-Main-Thread\uff08OMT\uff09\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3068\u306f\u3001<strong>UI \u306e\u72b6\u614b\u7ba1\u7406\u30fb\u30d3\u30b8\u30cd\u30b9\u30ed\u30b8\u30c3\u30af\u3092 Worker \u306b\u79fb\u3057\u3001\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306f\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u306e\u307f\u306b\u5c02\u5ff5\u3055\u305b\u308b<\/strong>\u8a2d\u8a08\u601d\u60f3\u3067\u3059\u3002Google \u304c\u958b\u767a\u3057\u305f\u30b2\u30fc\u30e0\u300cPROXX\u300d\u3067\u52b9\u679c\u304c\u5b9f\u8a3c\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>>\u3010OMT\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306e\u5206\u62c5\u3011\n\n\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\uff08UI\u30b9\u30ec\u30c3\u30c9\uff09\uff1a\n\u2192 DOM\u306e\u66f4\u65b0\u30fb\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u30fbCSS\u9069\u7528\n\u2192 \u30e6\u30fc\u30b6\u30fc\u64cd\u4f5c\u306e\u30a4\u30d9\u30f3\u30c8\u53d7\u4fe1\n\u2192 Worker\u304b\u3089\u53d7\u3051\u53d6\u3063\u305f\u72b6\u614b\u5909\u5316\u3092\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\n\u2192 \u62c5\u5f53\u3059\u308bJavaScript\u306f\u6700\u5c0f\u9650\u306b\u6291\u3048\u308b\n\nWorker\u30b9\u30ec\u30c3\u30c9\uff1a\n\u2192 \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u72b6\u614b\u7ba1\u7406\uff08Redux\u76f8\u5f53\uff09\n\u2192 \u30d3\u30b8\u30cd\u30b9\u30ed\u30b8\u30c3\u30af\u30fb\u8a08\u7b97\n\u2192 \u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u30fb\u5909\u63db\u30fb\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\n\u2192 \u72b6\u614b\u5909\u5316\u3092\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306b\u901a\u77e5\n\n\u30e1\u30ea\u30c3\u30c8\uff1a\n\u2705 \u30ed\u30fc\u30a8\u30f3\u30c9\u30c7\u30d0\u30a4\u30b9\uff08Android \u30a8\u30f3\u30c8\u30ea\u30fc\u30e2\u30c7\u30eb\u7b49\uff09\u3067\u3082UI\u304c\u6ed1\u3089\u304b\u306b\u306a\u308b\n\u2705 \u30ed\u30b8\u30c3\u30af\u304cDOM\u304b\u3089\u5206\u96e2\u3055\u308c\u3066\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u304c\u66f8\u304d\u3084\u3059\u304f\u306a\u308b\n\u2705 \u5c06\u6765\u7684\u306b\u30de\u30eb\u30c1\u30b3\u30a2\u3078\u306e\u30b9\u30b1\u30fc\u30eb\u30a2\u30a6\u30c8\u304c\u5bb9\u6613\n\u2705 UI\u3068\u30ed\u30b8\u30c3\u30af\u306e\u95a2\u5fc3\u4e8b\u3092\u660e\u78ba\u306b\u5206\u96e2\u3067\u304d\u308b\n\n\u6ce8\u610f\u70b9\uff1a\n\u2192 Worker-\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u9593\u306e\u901a\u4fe1\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u767a\u751f\u3059\u308b\n\u2192 DOM\u64cd\u4f5c\u306f\u4f9d\u7136\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306e\u307f\u53ef\u80fd\n\u2192 \u521d\u671f\u5b9f\u88c5\u30b3\u30b9\u30c8\u304c\u3084\u3084\u9ad8\u3044\uff08\u8a2d\u8a08\u3092\u4e01\u5be7\u306b\u8003\u3048\u308b\u5fc5\u8981\u304c\u3042\u308b\uff09<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">OMT \u306e\u5177\u4f53\u7684\u306a\u5b9f\u88c5\u4f8b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ state-worker.ts - OMT\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u30b9\u30c6\u30fc\u30c8\u7ba1\u7406Worker\n\ntype State = {\n  items: Item[]\n  filter: string\n  sortBy: string\n}\n\ntype Action =\n  | { type: 'SET_FILTER'; filter: string }\n  | { type: 'SET_SORT'; sortBy: string }\n  | { type: 'LOAD_ITEMS'; items: Item[] }\n\nlet state: State = {\n  items: [],\n  filter: '',\n  sortBy: 'name'\n}\n\nfunction reducer(state: State, action: Action): State {\n  switch (action.type) {\n    case 'SET_FILTER':\n      return { ...state, filter: action.filter }\n    case 'SET_SORT':\n      return { ...state, sortBy: action.sortBy }\n    case 'LOAD_ITEMS':\n      return { ...state, items: action.items }\n    default:\n      return state\n  }\n}\n\nfunction getFilteredSortedItems(state: State) {\n  return state.items\n    .filter(item =>\n      item.name.toLowerCase().includes(state.filter.toLowerCase())\n    )\n    .sort((a, b) =>\n      a[state.sortBy as keyof Item] > b[state.sortBy as keyof Item] ? 1 : -1\n    )\n}\n\naddEventListener('message', (event) => {\n  const action: Action = event.data\n\n  \/\/ \u72b6\u614b\u3092\u66f4\u65b0\n  state = reducer(state, action)\n\n  \/\/ \u30d5\u30a3\u30eb\u30bf\u30fc\u30fb\u30bd\u30fc\u30c8\u6e08\u307f\u306e\u30a2\u30a4\u30c6\u30e0\u3092\u8a08\u7b97\uff08\u91cd\u3044\u51e6\u7406\uff09\n  const displayItems = getFilteredSortedItems(state)\n\n  \/\/ \u5dee\u5206\u306e\u307f\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306b\u9001\u308b\n  postMessage({ type: 'STATE_UPDATE', displayItems })\n})<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u8a08\u6e2c\u3068\u6700\u9069\u5316\u306e\u30d2\u30f3\u30c8<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Chrome DevTools \u3067 Worker \u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8a08\u6e2c\u3059\u308b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>>\u3010Chrome DevTools \u3067\u306eWorker\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u8a08\u6e2c\u624b\u9806\u3011\n\n1. DevTools\u3092\u958b\u304f\uff08F12\uff09\n2. Performance\u30bf\u30d6\u3092\u9078\u629e\n3. \u300cRecord\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u51e6\u7406\u3092\u5b9f\u884c\n4. \u300cStop\u300d\u3067\u8a18\u9332\u7d42\u4e86\n\n\u78ba\u8a8d\u30dd\u30a4\u30f3\u30c8\uff1a\n- \u300cMain\u300d\u30b9\u30ec\u30c3\u30c9\u306e\u9577\u3044\u30bf\u30b9\u30af\uff08\u8d64\u304f\u30de\u30fc\u30af\u3055\u308c\u308b50ms\u8d85\u306e\u30bf\u30b9\u30af\uff09\n- \u300cWorker\u300d\u30b9\u30ec\u30c3\u30c9\u306e\u51e6\u7406\u6642\u9593\n- postMessage \u306e\u901a\u4fe1\u983b\u5ea6\u3068\u30b5\u30a4\u30ba\n\n\u6700\u9069\u5316\u306e\u6307\u6a19\uff1a\n- \u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306e\u30bf\u30b9\u30af\u3092 50ms \u4ee5\u4e0b\u306b\u6291\u3048\u308b\n- Worker\u3078\u306e postMessage \u306f\u983b\u7e41\u3059\u304e\u306a\u3044\uff08\u30d0\u30c3\u30c1\u51e6\u7406\u3092\u691c\u8a0e\uff09\n- \u5927\u304d\u306a\u30c7\u30fc\u30bf\u306fTransferable\u3092\u4f7f\u3046<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Worker \u901a\u4fe1\u306e\u30d0\u30c3\u30c1\u5316<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>>\/\/ \u983b\u7e41\u3059\u304e\u308bpostMessage\u306f\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u306b\u306a\u308b\n\/\/ \u30d0\u30c3\u30c1\u51e6\u7406\u3067\u901a\u4fe1\u56de\u6570\u3092\u6e1b\u3089\u3059\n\n\/\/ \u274c \u60aa\u3044\u4f8b\uff1a\u6bce\u30d5\u30ec\u30fc\u30e0worker\u306b\u9001\u4fe1\uff0860fps = 1\u79d260\u56de\uff09\nfunction onFrameUpdate(data) {\n  worker.postMessage({ type: 'UPDATE', data })  \/\/ 1\u79d2\u306b60\u56de\u9001\u4fe1\n}\n\n\/\/ \u2705 \u826f\u3044\u4f8b\uff1a\u30c7\u30fc\u30bf\u3092\u6e9c\u3081\u3066\u307e\u3068\u3081\u3066\u9001\u4fe1\uff08\u901a\u4fe1\u56de\u6570\u3092\u524a\u6e1b\uff09\nconst pendingData: unknown[] = []\n\nfunction onFrameUpdate(data) {\n  pendingData.push(data)\n}\n\n\/\/ 100ms \u3054\u3068\u306b\u30d0\u30c3\u30c1\u9001\u4fe1\nsetInterval(() => {\n  if (pendingData.length === 0) return\n  worker.postMessage({ type: 'BATCH_UPDATE', items: [...pendingData] })\n  pendingData.length = 0\n}, 100)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u3088\u304f\u3042\u308b\u8cea\u554f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Service Worker \u3068 Web Worker \u306e\u9055\u3044\u306f\u4f55\u3067\u3059\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Web Worker<\/strong> \u306f\u300c\u91cd\u3044\u51e6\u7406\u3092\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u304b\u3089\u30aa\u30d5\u30ed\u30fc\u30c9\u3059\u308b\u300d\u76ee\u7684\u3067\u4f7f\u3044\u307e\u3059\u3002\u30da\u30fc\u30b8\u306e\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u9023\u52d5\u3057\u3001\u30da\u30fc\u30b8\u3092\u9589\u3058\u308b\u3068\u7d42\u4e86\u3057\u307e\u3059\u3002<strong>Service Worker<\/strong> \u306f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d7\u30ed\u30ad\u30b7\u30fb\u30aa\u30d5\u30e9\u30a4\u30f3\u30ad\u30e3\u30c3\u30b7\u30e5\u30fb\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u306e\u53d7\u4fe1\u306b\u4f7f\u3046\u3082\u306e\u3067\u3001\u30da\u30fc\u30b8\u3092\u9589\u3058\u3066\u3082\u767b\u9332\u306f\u7dad\u6301\u3055\u308c\u307e\u3059\uff08PWA \u306e\u6838\u5fc3\u6280\u8853\uff09\u3002\u540d\u524d\u304c\u4f3c\u3066\u3044\u307e\u3059\u304c\u5168\u304f\u5225\u306e\u6280\u8853\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Worker \u9593\u3067 localStorage \u306f\u5171\u6709\u3067\u304d\u307e\u3059\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Worker \u304b\u3089 localStorage \u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002Worker \u304b\u3089\u6c38\u7d9a\u7684\u306a\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306b\u306f IndexedDB \u3092\u4f7f\u3044\u307e\u3059\uff08Worker \u304b\u3089 IndexedDB \u306f\u5229\u7528\u53ef\u80fd\uff09\u3002\u307e\u305f SharedArrayBuffer \u3092\u4f7f\u3063\u3066\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3068 Worker \u3067\u5171\u6709\u30e1\u30e2\u30ea\u3092\u4f7f\u3046\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u304c\u3001COOP\/COEP \u30d8\u30c3\u30c0\u30fc\u306e\u8a2d\u5b9a\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Vite \u3084 Webpack \u3067 Web Worker \u3092\u4f7f\u3046\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Vite \u3067\u306f <code>new Worker(new URL('.\/worker.ts', import.meta.url), { type: 'module' })<\/code> \u306e\u5f62\u5f0f\u3067 Worker \u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3059\u308b\u3060\u3051\u3067\u52d5\u4f5c\u3057\u307e\u3059\u3002TypeScript \u3082\u81ea\u52d5\u7684\u306b\u30c8\u30e9\u30f3\u30b9\u30d1\u30a4\u30eb\u3055\u308c\u307e\u3059\u3002Webpack \u3067\u306f <code>worker-loader<\/code> \u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u5c0e\u5165\u3059\u308b\u304b\u3001Webpack 5 \u4ee5\u964d\u3067\u306f\u540c\u69d8\u306e\u5f62\u5f0f\u304c\u30cd\u30a4\u30c6\u30a3\u30d6\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Web Workers \u3092\u4f7f\u3046\u3068\u30c7\u30d0\u30c3\u30b0\u304c\u96e3\u3057\u304f\u306a\u308a\u307e\u305b\u3093\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Chrome DevTools \u306f Worker \u306e\u30c7\u30d0\u30c3\u30b0\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002Sources \u30bf\u30d6\u306e\u5de6\u30b5\u30a4\u30c9\u30d0\u30fc\u306b\u300cWorkers\u300d\u3068\u3044\u3046\u30bb\u30af\u30b7\u30e7\u30f3\u304c\u3042\u308a\u3001Worker \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u30d6\u30ec\u30fc\u30af\u30dd\u30a4\u30f3\u30c8\u3092\u8a2d\u7f6e\u3067\u304d\u307e\u3059\u3002<code>console.log<\/code> \u3082 Worker \u5185\u3067\u4f7f\u3048\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u306f\u300c[Worker]\u300d\u3068\u3044\u3046\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u304c\u4ed8\u3044\u3066\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Worker \u5185\u3067 fetch \u3092\u4f7f\u3063\u3066 API \u3092\u53e9\u3051\u307e\u3059\u304b\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f7f\u3048\u307e\u3059\u3002Worker \u5185\u3067\u306f <code>fetch<\/code>\u30fb<code>setTimeout<\/code>\u30fb<code>setInterval<\/code>\u30fb<code>WebSocket<\/code>\u30fb<code>IndexedDB<\/code>\u30fb<code>crypto<\/code> \u306a\u3069\u306e API \u3092\u5229\u7528\u3067\u304d\u307e\u3059\u3002DOM \u64cd\u4f5c\uff08<code>document<\/code>\u30fb<code>window<\/code> \u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3078\u306e\u30a2\u30af\u30bb\u30b9\uff09\u306e\u307f\u5236\u9650\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u306e\u30d6\u30ed\u30c3\u30af<\/strong>\uff1a\u91cd\u3044\u51e6\u7406\u304c UI \u306e\u30d5\u30ea\u30fc\u30ba\u30fbINP\/LCP \u306e\u60aa\u5316\u3092\u5f15\u304d\u8d77\u3053\u3059\u3002Web Workers \u3067\u30aa\u30d5\u30ed\u30fc\u30c9\u3057\u3066 Core Web Vitals \u3092\u6539\u5584\u3067\u304d\u308b<\/li>\n<li><strong>postMessage<\/strong>\uff1a\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3068 Worker \u9593\u306e\u901a\u4fe1\u624b\u6bb5\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u30b3\u30d4\u30fc\u8ee2\u9001<\/li>\n<li><strong>TransferableObjects<\/strong>\uff1aArrayBuffer \u7b49\u3092\u6240\u6709\u6a29\u79fb\u8ee2\u3067\u30bc\u30ed\u30b3\u30d4\u30fc\u8ee2\u9001\u3002\u5927\u304d\u306a\u30c7\u30fc\u30bf\u306e\u8ee2\u9001\u901f\u5ea6\u3092\u5287\u7684\u306b\u6539\u5584\u3067\u304d\u308b<\/li>\n<li><strong>Comlink<\/strong>\uff1apostMessage \u3092\u30e9\u30c3\u30d7\u3057\u3066 Worker \u306e API \u3092\u901a\u5e38\u306e\u975e\u540c\u671f\u95a2\u6570\u306e\u3088\u3046\u306b\u547c\u3073\u51fa\u305b\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3002\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\uff08proxy\uff09\u306b\u3082\u5bfe\u5fdc<\/li>\n<li><strong>Worker Pool<\/strong>\uff1aCPU \u30b3\u30a2\u6570\u306b\u5408\u308f\u305b\u3066\u8907\u6570 Worker \u3092\u8d77\u52d5\u3057\u3001\u30bf\u30b9\u30af\u3092\u4e26\u5217\u51e6\u7406\u3059\u308b\u30d1\u30bf\u30fc\u30f3\u3002\u5927\u91cf\u30bf\u30b9\u30af\u306e\u51e6\u7406\u901f\u5ea6\u3092\u6700\u5927\u5316\u3067\u304d\u308b<\/li>\n<li><strong>\u30ab\u30b9\u30bf\u30e0 Hook<\/strong>\uff1a<code>useWorker<\/code> \u30d5\u30c3\u30af\u3067 React \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304b\u3089 Worker \u3092\u5ba3\u8a00\u7684\u306b\u4f7f\u3048\u308b<\/li>\n<li><strong>OMT \u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3<\/strong>\uff1aUI \u3068\u30ed\u30b8\u30c3\u30af\u3092\u5206\u96e2\u3057\u3066 Worker \u306b\u79fb\u3059\u3053\u3068\u3067\u3001\u3042\u3089\u3086\u308b\u30c7\u30d0\u30a4\u30b9\u3067\u5b89\u5b9a\u3057\u305f\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5b9f\u73fe\u3067\u304d\u308b<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><span class=\"swl-marker mark_yellow\">Web Workers \u306f\u300c\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u554f\u984c\u306b\u306a\u3063\u3066\u304b\u3089\u5bfe\u51e6\u3059\u308b\u300d\u306e\u3067\u306f\u306a\u304f\u3001\u8a2d\u8a08\u6bb5\u968e\u304b\u3089\u53d6\u308a\u8fbc\u3080\u3053\u3068\u3067\u6069\u6075\u304c\u6700\u5927\u5316\u3057\u307e\u3059\u3002\u307e\u305a\u91cd\u3044\u51e6\u7406\u30921\u3064 Worker \u306b\u79fb\u3057\u3066\u307f\u308b\u3053\u3068\u304b\u3089\u59cb\u3081\u307e\u3057\u3087\u3046\u3002TransferableObjects \u3068 Comlink \u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u5b9f\u88c5\u30b3\u30b9\u30c8\u3092\u4f4e\u304f\u4fdd\u3061\u306a\u304c\u3089\u9ad8\u3044\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/span><\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">WithCode\u3092\u4f53\u9a13\u3067\u304d\u308b\u521d\u7d1a\u30b3\u30fc\u30b9\u516c\u958b\u4e2d\uff01<\/h2>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-white-color has-text-color has-background wp-element-button\" href=\"https:\/\/withcode.tech\/reservation\/\" style=\"background-color:#ffbf00\"><strong>\u516c\u5f0f\u30b5\u30a4\u30c8\u304b\u3089\u7121\u6599\u30ab\u30a6\u30f3\u30bb\u30ea\u30f3\u30b0\u306b\u7533\u3057\u8fbc\u3080 \u2192<\/strong><\/a><\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Web Workers\u3067JavaScript\u306e\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3092\u30d6\u30ed\u30c3\u30af\u3057\u306a\u3044\u65b9\u6cd5\u3092\u5fb9\u5e95\u89e3\u8aac\u3002postMessage\u30fbTransferableObjects\u30fbComlink\u30fbWorker Pool\u30d1\u30bf\u30fc\u30f3\u30fbReact\u30ab\u30b9\u30bf\u30e0\u30d5\u30c3\u30af\u307e\u3067\u3001\u5b9f\u88c5\u30b3\u30fc\u30c9\u4ed8\u304d\u3067\u5b8c\u5168\u30ac\u30a4\u30c9\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"swell_btn_cv_data":"","footnotes":"","vk-ltc-link":"","vk-ltc-target":"0"},"categories":[34,359],"tags":[],"class_list":["post-13174","post","type-post","status-publish","format-standard","hentry","category-programming","category-javascript-programming"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/posts\/13174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/comments?post=13174"}],"version-history":[{"count":4,"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/posts\/13174\/revisions"}],"predecessor-version":[{"id":14004,"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/posts\/13174\/revisions\/14004"}],"wp:attachment":[{"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/media?parent=13174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/categories?post=13174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/withcode.tech\/media\/wp-json\/wp\/v2\/tags?post=13174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}