{"id":554,"date":"2019-06-30T23:42:43","date_gmt":"2019-06-30T14:42:43","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2019\/06\/30\/javascript-concurrency-model"},"modified":"2019-06-30T23:42:43","modified_gmt":"2019-06-30T14:42:43","slug":"javascript-concurrency-model","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2019\/06\/30\/javascript-concurrency-model\/","title":{"rendered":"JavaScript\u306e\u540c\u6642\u5b9f\u884c\u30e2\u30c7\u30eb\u306b\u3064\u3044\u3066"},"content":{"rendered":"
<\/head><\/p>\nJavaScript\u304c\u591a\u304f\u306e\u8a00\u8a9e\u3068\u7570\u306a\u308b\u70b9\u306e\u3072\u3068\u3064\u306b\u3001\u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7\u30d9\u30fc\u30b9\u306e\u540c\u6642\u5b9f\u884c\u30e2\u30c7\u30eb<\/strong>\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u3001JavaScript\u81ea\u4f53\u3068\u3044\u3046\u3088\u308a\u3082\u3001\u30d6\u30e9\u30a6\u30b6\u306e\u4ed5\u7d44\u307f\u306b\u3082\u95a2\u308f\u308a\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n \u4eca\u56de\u306f\u305d\u308c\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n MDN\u306e\u56f3\u3092\u62dd\u501f\u3059\u308b\u3068\u3001JavaScript\u306e\u30e9\u30a4\u30f3\u30bf\u30a4\u30e0\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8981\u7d20\u3067\u69cb\u6210\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3072\u3068\u3064\u305a\u3064\u8aac\u660e\u3057\u3066\u3086\u304d\u307e\u3059\u3002<\/p>\n <\/p>\n \u30d2\u30fc\u30d7\u306f\u30d2\u30fc\u30d7\u3067\u3059\u306d\u3002\u4eca\u56de\u306e\u30c6\u30fc\u30de\u3068\u306f\u5c11\u3057\u5916\u308c\u308b\u306e\u3067\u7701\u7565\u3057\u307e\u3059\u3002<\/p>\n JavaScript\u3067\u51e6\u7406\u3092\u547c\u3073\u51fa\u3059\u3068\u3001\u30b3\u30fc\u30eb\u30b9\u30bf\u30c3\u30af\u304c\u7a4d\u307f\u4e0a\u304c\u308a\u307e\u3059<\/strong>\u3002<\/p>\n JavaScript\u306f\u30b7\u30f3\u30b0\u30eb\u30b9\u30ec\u30c3\u30c9\u306a\u306e\u3067\u3001\u4e00\u5ea6\u306b\u3072\u3068\u3064\u306e\u51e6\u7406\u3057\u304b\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306a\u51e6\u7406\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n \u3053\u308c\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30bf\u30c3\u30af\u3092\u5f62\u6210\u3057\u307e\u3059\u3002<\/p>\n <\/p>\n \u4e0a\u8a18\u306e\u3088\u3046\u306b\u540c\u671f\u7684\u306a\u95a2\u6570\u5b9f\u884c\u3067\u306f\u3001\u51e6\u7406\u304c\u3072\u3068\u3064\u305a\u3064\u884c\u308f\u308c\u3066\u3086\u304f\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n JavaScript\u306b\u304a\u3051\u308b\u30ad\u30e5\u30fc\u3068\u306f\u3001\u6b21\u306b\u5b9f\u884c\u3059\u3079\u304d\u51e6\u7406\u306e\u4e00\u89a7\u3068\u3044\u3048\u307e\u3059\u3002<\/strong><\/p>\n \u3053\u3053\u3067\u306f \u3053\u308c\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30bf\u30c3\u30af\u3068\u30ad\u30e5\u30fc\u3092\u5f62\u6210\u3057\u307e\u3059\u3002<\/p>\n <\/p>\n \u3055\u3089\u306b\u3001 \u3053\u308c\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30bf\u30c3\u30af\u3068\u30ad\u30e5\u30fc\u3092\u5f62\u6210\u3057\u307e\u3059\u3002<\/p>\n <\/p>\n \u4e0a\u8a18\u306e\u3088\u3046\u306b\u3001\u547c\u3073\u51fa\u3057\u81ea\u4f53\u306f\u95a2\u6570\u3072\u3068\u3064\u305a\u3064\u3067\u3059\u304c\u3001\u51e6\u7406\u81ea\u4f53\u306f\u30d6\u30e9\u30a6\u30b6API\u306b\u3088\u3063\u3066\u540c\u6642\u5b9f\u884c\u3055\u308c\u3001\u5b8c\u4e86\u3057\u305f\u3082\u306e\u304b\u3089JavaScript\u5074\u306e\u30ad\u30e5\u30fc\u306b\u305f\u307e\u3063\u3066\u3086\u304f\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3067\u3059\u3002<\/p>\n \u3053\u308c\u306f\u30b9\u30ec\u30c3\u30c9\u306a\u3069\u3067\u5b9f\u73fe\u3067\u304d\u308b ( \u4e0a\u8a18\u3067\u3082\u8a00\u53ca\u3057\u305f\u3001\u30ad\u30e5\u30fc\u3092\u691c\u77e5\u3067\u304d\u308b\u4ed5\u7d44\u307f\u3092\u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7\u3068\u547c\u3073\u307e\u3059<\/strong>\u3002\u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7\u306f\u3001\u30a4\u30d9\u30f3\u30c8\u3092\u5f85\u6a5f\u3059\u308b\u5b9f\u88c5\u306e\u3072\u3068\u3064\u3067\u3001MDN\u306e\u4f8b\u3092\u501f\u308a\u308b\u306a\u3089\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5b9f\u88c5\u306b\u4f3c\u3066\u3044\u307e\u3059\u3002<\/p>\n \u30b7\u30f3\u30b0\u30eb\u30b9\u30ec\u30c3\u30c9\u3067\u306e\u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7\u306f\u3001\u540c\u6642\u591a\u767a\u7684\u306b\u767a\u751f\u3059\u308b\u30a4\u30d9\u30f3\u30c8\u3092\u3001\u8efd\u91cf\u306b\u6271\u3046\u306e\u306b\u5411\u3044\u3066\u3044\u307e\u3059<\/strong>\u3002\u3053\u308c\u306f\u30d7\u30ed\u30bb\u30b9\u304c\u5927\u91cf\u306b\u7acb\u3061\u4e0a\u304c\u308a\u3001\u30e1\u30e2\u30ea\u3084\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30b9\u30a4\u30c3\u30c1\u3067\u51e6\u7406\u304c\u91cd\u304f\u306a\u308b\u306e\u3092\u9632\u3050\u3053\u3068\u304c\u3067\u304d\u308b\u304b\u3089\u3067\u3059\u3002(\u305f\u3060\u3057\u3001\u5927\u91cf\u306e\u8a08\u7b97\u306a\u3069\u6642\u9593\u306e\u304b\u304b\u308b\u51e6\u7406\u306f\u82e6\u624b\u3067\u3001\u51e6\u7406\u304c\u7d42\u308f\u308b\u307e\u3067\u5f8c\u7d9a\u51e6\u7406\u3092\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3057\u307e\u3044\u307e\u3059)\u3002<\/p>\n JavaScript\u4ee5\u5916\u3067\u30b7\u30f3\u30b0\u30eb\u30b9\u30ec\u30c3\u30c9\u306e\u30a4\u30d9\u30f3\u30c8\u99c6\u52d5\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3092\u63a1\u7528\u3057\u3066\u3044\u308b\u3082\u306e\u3068\u3057\u3066\u306f\u3001nginx\u304c\u6709\u540d\u3067\u3059\u3002<\/p>\n nginx\u306f\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306a\u65b9\u91dd\u3067C10K\u554f\u984c\u3092\u89e3\u6c7a\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u3066\u3001Node.js\u3082\u305d\u306e\u6587\u8108\u3067\u8a71\u3055\u308c\u3066\u3044\u308b\u306e\u3092\u305f\u307e\u306b\u307f\u304b\u3051\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u3082\u3068\u3082\u3068JavaScript\u306f\u300190\u5e74\u4ee3\u306e\u30a6\u30a7\u30d6\u30d6\u30e9\u30a6\u30b6\u3068\u3044\u3046\u3001\u5341\u5206\u306a\u30ea\u30bd\u30fc\u30b9\u304c\u306a\u3044\u74b0\u5883\u306e\u305f\u3081\u306b\u958b\u767a\u3055\u308c\u305f\u8a00\u8a9e\u3067\u3059\u3002\u9650\u3089\u308c\u305fCPU\u3067\u5c11\u3057\u3067\u3082\u307e\u3068\u3082\u306b\u52d5\u304f\u3088\u3046\u306b\u5b9f\u88c5\u3055\u308c\u305f\u306e\u304c\u30b7\u30f3\u30b0\u30eb\u30b9\u30ec\u30c3\u30c9+\u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7\u3068\u3044\u3046\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3060\u3063\u305f\u3001\u3068\u3044\u3046\u306e\u304c\u6b63\u3057\u3044\u80cc\u666f\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n \u3064\u307e\u308a\u3001\u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7\u306e\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u767a\u751f\u3059\u308b\u5927\u91cf\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u51e6\u7406\u3059\u308b\u306e\u306b(\u5c11\u306a\u304f\u3068\u3082\u5f53\u6642\u306f)\u6700\u9069\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u3067\u3042\u3063\u305f\u3068\u8003\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059<\/strong>\u3002\u73fe\u5728\u3067\u306f\u3001Go\u306e\u3088\u3046\u306b\u8efd\u91cf\u30b9\u30ec\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u305f\u65b9\u304c\u7dda\u304c\u3044\u3044\u5834\u5408\u3082\u591a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n \u3053\u3053\u3067\u5c11\u3057\u5b9f\u969b\u306b\u5f79\u306b\u7acb\u3061\u305d\u3046\u306a\u4f8b\u3092\u898b\u3066\u307f\u307e\u3059\u3002<\/p>\n \u6709\u540d\u306a\u4f8b\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u3001 \u3053\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3068\u3001\u5b9f\u969b\u306e\u753b\u9762\u5909\u66f4\u306f\u3059\u3050\u306b\u306f\u884c\u308f\u308c\u307e\u305b\u3093\u3002\u30d6\u30e9\u30a6\u30b6\u3067\u63cf\u753b\u306e\u51e6\u7406\u304c\u8d70\u308b\u524d\u306b\u300110\u5104\u56de\u306e\u30eb\u30fc\u30d7\u3067\u30b9\u30ec\u30c3\u30c9\u304c\u57cb\u307e\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u63cf\u753b\u304c\u5f8c\u56de\u3057\u306b\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3092\u898b\u308b\u3068 <\/p>\n \u63cf\u753b\u3092\u65e9\u304f\u3059\u308b\u65b9\u6cd5\u306e\u3072\u3068\u3064\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300c \u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u63cf\u753b\u51e6\u7406\u3092\u5148\u306b\u8d70\u3089\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u305f\u3081\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6539\u5584\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n <\/p>\n \u305f\u3060\u3057\u3001\u5f8c\u7d9a\u306e\u51e6\u7406\u3092\u30d6\u30ed\u30c3\u30af\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u306b\u306f\u5909\u308f\u308a\u306a\u3044\u306e\u3067\u3001\u51e6\u7406\u4e2d\u306e\u8868\u793a\u306b\u3057\u305f\u308a\u3001Worker\u3092\u4f7f\u3063\u305f\u308a\u3059\u308b\u306a\u3069\u3082\u691c\u8a0e\u3057\u305f\u307b\u3046\u304c\u3088\u3055\u305d\u3046\u3067\u3059\u3002\u3044\u305a\u308c\u306b\u305b\u3088\u3001\u4ed5\u7d44\u307f\u3092\u7406\u89e3\u3057\u3066\u304a\u304f\u3053\u3068\u306f\u601d\u308f\u306c\u4e8b\u6545\u3078\u306e\u30ea\u30b9\u30af\u30d8\u30c3\u30b8\u306b\u3082\u306a\u308b\u3068\u8003\u3048\u307e\u3059\u3002<\/p>\n \u4eca\u56de\u306fJavaScript\u306e\u540c\u6642\u5b9f\u884c\u30e2\u30c7\u30eb\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002\u4ee5\u4e0b\u306e\u8a00\u8449\u3092\u805e\u3044\u3066\u30b9\u30c3\u3068\u30a4\u30e1\u30fc\u30b8\u304c\u3067\u304d\u308c\u3070\u3053\u306e\u8a18\u4e8b\u306e\u307e\u3068\u3081\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u306a\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n \u304a\u5f79\u306b\u7acb\u3066\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n <\/body><\/html><\/p>\n","protected":false},"excerpt":{"rendered":" \u6982\u8981 JavaScript\u304c\u591a\u304f\u306e\u8a00\u8a9e\u3068\u7570\u306a\u308b\u70b9\u306e\u3072\u3068\u3064\u306b\u3001\u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7\u30d9\u30fc\u30b9\u306e\u540c\u6642\u5b9f\u884c\u30e2\u30c7\u30eb\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u3001JavaScript\u81ea\u4f53\u3068\u3044\u3046\u3088\u308a\u3082\u3001\u30d6\u30e9\u30a6\u30b6\u306e\u4ed5\u7d44\u307f\u306b\u3082\u95a2\u308f\u308a\u304c\u3042\u308a\u307e\u3059\u3002 \u4eca\u56de\u306f\u305d\u308c\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002 \u76ee\u6b21 \u6982\u8981 \u30e9\u30a4\u30f3\u30bf\u30a4\u30e0 \u30d2\u30fc\u30d7 \u30b9\u30bf\u30c3\u30af \u30ad\u30e5\u30fc \u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7 \u5fdc\u7528\u4f8b \u307e\u3068\u3081 \u53c2\u8003 \u30e9\u30a4\u30f3\u30bf\u30a4\u30e0 MDN\u306e\u56f3\u3092\u62dd\u501f\u3059\u308b\u3068\u3001JavaScript\u306e\u30e9\u30a4\u30f3\u30bf\u30a4\u30e0 […]<\/p>\n","protected":false},"author":1,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[77],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/554"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=554"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/554\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\u76ee\u6b21<\/h2>\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\u30e9\u30a4\u30f3\u30bf\u30a4\u30e0<\/h2>\n
\u30d2\u30fc\u30d7<\/h2>\n
\u30b9\u30bf\u30c3\u30af<\/h2>\n
function subA() { console.log('A'); }\nfunction subB() { console.log('B'); }\n\nfunction main() {\n subA();\n subB();\n}\n\nmain();<\/code><\/pre>\n
\n
main<\/code>\u306e\u30d5\u30ec\u30fc\u30e0<\/li>\n
main<\/code>\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u305f
subA<\/code>\u306e\u30d5\u30ec\u30fc\u30e0<\/li>\n
subA<\/code>\u306e\u5b9f\u884c\u304c\u5b8c\u4e86\u3059\u308b\u3068
subA<\/code>\u306e\u30d5\u30ec\u30fc\u30e0\u306f\u30b9\u30bf\u30c3\u30af\u304b\u3089\u30dd\u30c3\u30d7\u30a2\u30a6\u30c8<\/li>\n
main<\/code>\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u305f
subB<\/code>\u306e\u30d5\u30ec\u30fc\u30e0<\/li>\n
subB<\/code>\u306e\u5b9f\u884c\u304c\u5b8c\u4e86\u3059\u308b\u3068
subB<\/code>\u306e\u30d5\u30ec\u30fc\u30e0\u306f\u30b9\u30bf\u30c3\u30af\u304b\u3089\u30dd\u30c3\u30d7\u30a2\u30a6\u30c8<\/li>\n
main<\/code>\u306e\u30d5\u30ec\u30fc\u30e0\u306f\u30b9\u30bf\u30c3\u30af\u304b\u3089\u30dd\u30c3\u30d7\u30a2\u30a6\u30c8<\/li>\n<\/ol>\n
\u30ad\u30e5\u30fc<\/h2>\n
setTimeout<\/code>\u3092\u4f7f\u7528\u3057\u305f\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8003\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n
function setTimeoutCallback() {\n console.log('A');\n}\n\nfunction subA() {\n setTimeout(setTimeoutCallback, 7000)\n}\n\nfunction subB() { console.log('B'); }\n\nfunction main() {\n subA();\n subB();\n}\n\nmain();<\/code><\/pre>\n
\n
main<\/code>\u306e\u30d5\u30ec\u30fc\u30e0<\/li>\n
main<\/code>\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u305f
subA<\/code>\u306e\u30d5\u30ec\u30fc\u30e0<\/li>\n
subA<\/code>\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u305f
setTimeout<\/code>\u306e\u30d5\u30ec\u30fc\u30e0<\/li>\n
setTimeout<\/code>\u306e\u5b9f\u884c\u304c\u5b8c\u4e86\u3059\u308b\u3068
setTimeout<\/code>\u306e\u30d5\u30ec\u30fc\u30e0\u306f\u30b9\u30bf\u30c3\u30af\u304b\u3089\u30dd\u30c3\u30d7\u30a2\u30a6\u30c8\u3002\u30d6\u30e9\u30a6\u30b6\u5074\u3067\u30bf\u30a4\u30de\u30fc\u306e\u8a08\u7b97\u958b\u59cb\u3002<\/strong><\/li>\n
main<\/code>\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u305f
subB<\/code>\u306e\u30d5\u30ec\u30fc\u30e0<\/li>\n
subB<\/code>\u306e\u5b9f\u884c\u304c\u5b8c\u4e86\u3059\u308b\u3068
subB<\/code>\u306e\u30d5\u30ec\u30fc\u30e0\u306f\u30b9\u30bf\u30c3\u30af\u304b\u3089\u30dd\u30c3\u30d7\u30a2\u30a6\u30c8<\/li>\n
4<\/code>\u306e\u30bf\u30a4\u30de\u30fc\u304c\u7d42\u4e86\u3059\u308b\u3068\u3001\u30d6\u30e9\u30a6\u30b6\u304c\u30a4\u30d9\u30f3\u30c8\u3092\u30ad\u30e5\u30fc\u306b\u8ffd\u52a0\u3059\u308b<\/strong><\/li>\n
main<\/code>\u306e\u30d5\u30ec\u30fc\u30e0\u306f\u30b9\u30bf\u30c3\u30af\u304b\u3089\u30dd\u30c3\u30d7\u30a2\u30a6\u30c8<\/li>\n<\/ol>\n
4<\/code>\u3067\u30bf\u30a4\u30de\u30fc\u306e\u51e6\u7406\u304cJavaScript\u306e\u30e1\u30a4\u30f3\u30b9\u30ec\u30c3\u30c9\u3092\u96e2\u308c\u3066\u304a\u308a\u3001\u30ad\u30e5\u30fc\u306e\u4ed5\u7d44\u307f\u304c\u3042\u308b\u3053\u3068\u3067\u30ce\u30f3\u30d6\u30ed\u30c3\u30ad\u30f3\u30b0\u306b\u51e6\u7406\u304c\u9032\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n
setTimeout<\/code>\u3092\u9023\u7d9a\u3067\u547c\u3073\u51fa\u3059\u5834\u5408\u3082\u8003\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n
function setTimeoutCallback() {\n console.log('A');\n}\n\nfunction subA() {\n setTimeout(setTimeoutCallback, 7000)\n setTimeout(setTimeoutCallback, 7000)\n setTimeout(setTimeoutCallback, 7000)\n setTimeout(setTimeoutCallback, 7000)\n setTimeout(setTimeoutCallback, 7000)\n}\n\nfunction subB() { console.log('B'); }\n\nfunction main() {\n subA();\n subB();\n}\n\nmain();<\/code><\/pre>\n
\u4e26\u5217(parallel)<\/code>\u51e6\u7406\u3068\u306f\u3044\u3048\u307e\u305b\u3093\u304c\u3001\u5b9f\u969b\u306e\u51e6\u7406\u3092JavaScript\u30e9\u30f3\u30bf\u30a4\u30e0\u306e\u5916\u306b\u3060\u3059\u3053\u3068\u3067\u3001
\u4e26\u884c(concurrent)<\/code>\u306b\u51e6\u7406\u3092\u5b9f\u884c\u3057\u3066\u3044\u308b\u3068\u8a00\u3048\u307e\u3059\u3002<\/p>\n
\u4e26\u884c<\/code>\/
\u4e26\u5217<\/code>\/
\u975e\u540c\u671f<\/code>\/
\u30ce\u30f3\u30d6\u30ed\u30c3\u30ad\u30f3\u30b0<\/code>\u3042\u305f\u308a\u306f\u52d8\u9055\u3044\u3055\u308c\u3084\u3059\u3044\u306e\u3067\u3001\u9055\u3044\u3092\u304a\u3055\u3048\u3066\u304a\u304f\u3068\u3044\u3044\u3068\u601d\u3044\u307e\u3059)\u3002<\/p>\n
\u30a4\u30d9\u30f3\u30c8\u30eb\u30fc\u30d7<\/h2>\n
while(queue.waitForMessage()){\n queue.processNextMessage();\n}<\/code><\/pre>\n
\u5fdc\u7528\u4f8b<\/h2>\n
setTimeout(func, 0)<\/code>\u3092\u4f7f\u3063\u3066\u51e6\u7406\u3092\u30ad\u30e5\u30fc\u306b\u5916\u51fa\u3057\u3057\u3001\u63cf\u753b\u30bf\u30a4\u30df\u30f3\u30b0\u3092\u65e9\u304f\u3059\u308b\u3068\u3044\u3046\u624b\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001DOM\u306e\u5909\u66f4\u51e6\u7406\u306e\u3042\u3068\u306b\u3001\u304b\u306a\u308a\u6642\u9593\u306e\u304b\u304b\u308b\u51e6\u7406\u304c\u3042\u3063\u305f\u3068\u3057\u307e\u3059\u3002<\/p>\n
\/\/ DOM\u306e\u5909\u66f4\u51e6\u7406\nvar target = document.getElementById('target');\ntarget.textContent = 'updated';\n\n\/\/ \u6642\u9593\u306e\u304b\u304b\u308b\u51e6\u7406\nvar calcResult;\nfunction longTask() {\n for (var i = 0; i < 1000000000; i++) {\n calcResult = i * 3;\n }\n}\nlongTask();<\/code><\/pre>\n
longTask<\/code>\u306b\u7d044\u79d2\u304b\u304b\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u306e\u5206\u30e6\u30fc\u30b6\u30fc\u306f\u30a4\u30f3\u30bf\u30e9\u30af\u30b7\u30e7\u30f3\u3092\u5f85\u3064\u3053\u3068\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n
setTimeout(func, 0)<\/code>\u3067\u51e6\u7406\u3092\u4e00\u65e6\u30ad\u30e5\u30fc\u306b\u62bc\u3057\u8fbc\u3081\u308b\u300d\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n
\/\/ DOM\u306e\u5909\u66f4\u51e6\u7406\nvar target = document.getElementById('target');\ntarget.textContent = 'updated';\n\n\/\/ \u6642\u9593\u306e\u304b\u304b\u308b\u51e6\u7406\nvar calcResult;\nwindow.setTimeout(function longTask() {\n for (var i = 0; i < 1000000000; i++) {\n calcResult = i * 3;\n }\n}, 0)<\/code><\/pre>\n
\u307e\u3068\u3081<\/h2>\n
\n
\u53c2\u8003<\/h2>\n
\n