{"id":366558,"date":"2024-05-21T03:02:34","date_gmt":"2024-05-21T03:02:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=366558"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T03:02:34","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=366558","title":{"rendered":"<span>Event Loop. \u041c\u0438\u0444\u044b \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0435\u0442\u0438 \u0435\u0441\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u00a0<strong>Event loop<\/strong>\u00a0\u0438 \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u043e\u0432\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u0438 \u043f\u043e \u0441\u0435\u0439 \u0434\u0435\u043d\u044c, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435. \u041e\u0434\u043d\u0430\u043a\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0432 \u044d\u0442\u0438\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0439. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0447\u0435\u043c, \u0441\u0430\u043c\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043e\u0431\u0440\u043e\u0441\u043b\u043e \u0440\u044f\u0434\u043e\u043c \u043c\u0438\u0444\u043e\u0432 \u0438 \u0434\u043e\u0433\u0430\u0434\u043e\u043a. \u041f\u043e\u0440\u043e\u0439, \u0434\u0430\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u0430\u043b\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u043e\u043f\u044b\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0433\u0434\u0435 \u0438\u0441\u0442\u0438\u043d\u0430, \u0430 \u0433\u0434\u0435, \u0447\u0438\u0441\u0442\u043e\u0439 \u0432\u043e\u0434\u044b, \u0432\u044b\u043c\u044b\u0441\u0435\u043b.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0433\u0434\u0435 \u0436\u0435, \u0432\u0441\u0435 \u0442\u0430\u043a\u0438, \u0438\u0441\u0442\u0438\u043d\u0430. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0438\u043b\u0438 \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0441\u0432\u043e\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f \u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h3>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 Event loop \u0432 JavaScript?<\/h3>\n<p>\u041f\u043e\u043d\u044f\u0442\u0438\u0435\u00a0<strong>Event loop<\/strong>\u00a0\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u042d\u0442\u043e \u0444\u0430\u043a\u0442. \u041d\u043e \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>\u00a0\u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043c. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u00a0<strong>Event loop<\/strong>\u00a0\u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u044f\u0437\u044b\u043a\u0430\u00a0<strong>JavaScript (ECMAScript)<\/strong>\u00a0\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439. \u042d\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0432\u0438\u0436\u043a\u0430 JavaScript \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<strong>Event loop<\/strong>\u00a0\u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 API \u0441\u0440\u0435\u0434\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<h3>\u0427\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f Event loop?<\/h3>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438 \u0432\u044b\u0448\u0435, \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>\u00a0\u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0439 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u00a0<strong>Event loop<\/strong>, \u0442.\u043a. \u043e\u043d\u043e \u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0435 \u0437\u043e\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430, \u043d\u043e \u0432 \u0437\u043e\u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442 JavaScript \u043a\u043e\u0434. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u0441\u043a\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431\u00a0<strong>Event loop<\/strong>\u00a0\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u0445, \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445, \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0438\u043b\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f. \u0422\u0430\u043a\u0438\u0445 \u0441\u0440\u0435\u0434, \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e. \u0423\u0441\u043b\u043e\u0432\u043d\u043e, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b: \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0438 \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435.<\/p>\n<h4>\u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b<\/h4>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u043a\u0438\u0445 \u0441\u0440\u0435\u0434 \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f WHATWG \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 HTML<\/a>.<\/p>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u00a0<strong>Event loop<\/strong>\u00a0\u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#event-loops\" rel=\"noopener noreferrer nofollow\">8.1.7 Event loops<\/a>. \u041e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u0445\u00a0<strong>Event loop<\/strong>\u00a0\u0432 Web API \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435. \u041f\u043e\u043a\u0430 \u0443\u043f\u043e\u043c\u044f\u043d\u0443 \u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0442 API \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Chromium \u0432 MacOS \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/nsrunloop\" rel=\"noopener noreferrer nofollow\">NSRunLoop<\/a>, \u0430 \u0432 Linux &#8212; \u043d\u0430\u00a0<a href=\"https:\/\/docs.gtk.org\/glib\/\" rel=\"noopener noreferrer nofollow\">glib<\/a>.<\/p>\n<p>\u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0437\u0434\u0435\u0441\u044c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Electron, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0438\u043b\u0443 \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u0440\u043e\u0441\u0441-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\u00a0<strong>Event loop<\/strong>\u00a0\u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u041e\u0421 \u0438 \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 Node.js (\u043e\u0431 \u044d\u0442\u043e\u043c \u0434\u0430\u043b\u044c\u0448\u0435).<\/p>\n<h4>\u041d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b<\/h4>\n<p>\u0422\u0430\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u044b, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 HTML<\/a>. \u0418, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432 \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 (\u043a\u0440\u043e\u043c\u0435\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>), \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0430\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e.<\/p>\n<p>\u0421\u0430\u043c\u043e\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439, \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c, \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<a href=\"https:\/\/nodejs.org\/api\/all.html\" rel=\"noopener noreferrer nofollow\">Node.js<\/a>.<\/p>\n<p>\u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Node.js (\u0432\u0435\u0440\u0441\u0438\u044f Node.js v21.6.1 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438) \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<a href=\"https:\/\/nodejs.org\/api\/all.html#all_n-api_libuv-event-loop\" rel=\"noopener noreferrer nofollow\">libuv even loop<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u0432 Node API, \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>napi_get_uv_event_loop<\/code>, \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439\u00a0<strong>Event loop<\/strong>.<\/p>\n<p>\u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u00a0<strong>Event loop<\/strong>\u00a0\u044d\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435 \u0434\u0430\u0435\u0442. \u041d\u043e \u0438\u0437 \u043d\u0435\u0451 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043d\u043e\u0433\u043e, Node.js \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f Node.js, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e\u00a0<strong>Event loop<\/strong>\u00a0\u0432 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u0431\u0438\u0431\u0438\u043b\u043e\u0442\u0435\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438. \u0412\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b API\u00a0<a href=\"http:\/\/docs.libuv.org\/en\/v1.x\/loop.html\" rel=\"noopener noreferrer nofollow\">uv_loop_t<\/a>, \u0434\u0430\u044e\u0449\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e API \u0432 \u0447\u0430\u0441\u0442\u0438\u00a0<strong>Event loop<\/strong>. \u0422\u0430\u043a \u0436\u0435, \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f\u00a0<a href=\"http:\/\/docs.libuv.org\/en\/v1.x\/design.html\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b Event loop<\/a>, \u0438\u00a0<a href=\"http:\/\/docs.libuv.org\/en\/v1.x\/guide\/basics.html#event-loops\" rel=\"noopener noreferrer nofollow\">\u0433\u0430\u0439\u0434<\/a>\u00a0\u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0<strong>Event loop<\/strong>\u00a0\u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<p>\u041a \u0434\u0440\u0443\u0433\u0438\u043c \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438\u00a0<a href=\"https:\/\/deno.com\/\" rel=\"noopener noreferrer nofollow\">Deno<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/bun.sh\/\" rel=\"noopener noreferrer nofollow\">Bun<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>\u00a0\u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0<strong>Event loop<\/strong>.<\/p>\n<p>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b, \u0442\u0430\u043a\u0438\u0435, \u043a\u0430\u043a\u00a0<a href=\"https:\/\/reactnative.dev\/\" rel=\"noopener noreferrer nofollow\">React Native<\/a>,\u00a0<a href=\"https:\/\/nativescript.org\/\" rel=\"noopener noreferrer nofollow\">NativeScript<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/cordova.apache.org\/\" rel=\"noopener noreferrer nofollow\">Apache Cordova<\/a>\u00a0\u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c\u0438. \u041e\u043d\u0438 \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 API \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u041e\u0421, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f Andriod \u044d\u0442\u043e\u00a0<a href=\"https:\/\/developer.android.com\/reference\/android\/os\/Looper\" rel=\"noopener noreferrer nofollow\">Android.os.Looper<\/a>, \u0430 \u0434\u043b\u044f iOS &#8212;\u00a0<a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/runloop\/\" rel=\"noopener noreferrer nofollow\">RunLoop<\/a>.<\/p>\n<h3>\u041d\u043e \u0432\u0435\u0434\u044c \u0431\u0435\u0437 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 Event loop, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 JavaScript-\u043a\u043e\u0434\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0440\u0430\u0439\u043d\u0435 \u0442\u0440\u0443\u0434\u043d\u043e. \u041a\u0430\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f ECMA-262 \u043c\u043e\u0433\u043b\u0430 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0432\u0430\u0436\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c?<\/h3>\n<p>\u041d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u044f Event loop \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>\u00a0\u043d\u0435\u0442, \u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430. \u041d\u043e \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u044d\u0442\u0430 \u043d\u0435 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0435\u043d\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u0438. \u0412\u043e\u043e\u0431\u0449\u0435, \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f JavaScript \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u0446\u0435\u043b\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-executable-code-and-execution-contexts\" rel=\"noopener noreferrer nofollow\">9 Executable Code and Execution Contexts<\/a>. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432 \u043f.\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-agents\" rel=\"noopener noreferrer nofollow\">9.7 Agents<\/a>, \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#agent\" rel=\"noopener noreferrer nofollow\">Agent<\/a>, \u0447\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#agent-record\" rel=\"noopener noreferrer nofollow\">Agent Record<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u043b\u044f, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0435 \u0437\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0433\u0435\u043d\u0442\u0430 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043e\u0432\u0435\u0441\u0442\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f, \u043e\u0434\u043d\u0430\u043a\u043e, \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f.\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-forward-progress\" rel=\"noopener noreferrer nofollow\">9.9 Forward Progress<\/a>\u00a0\u0438\u0437\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0433\u0435\u043d\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>\u0410\u0433\u0435\u043d\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0433\u0435\u043d\u0442, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u0435 ActiveRecord\u00a0<code>[[CanBlock]]<\/code>\u00a0\u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>true<\/code><\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0430\u0433\u0435\u043d\u0442\u043e\u043c \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0433\u0435\u043d\u0442 \u0441 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0438\u0442\u043e\u0433\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0432\u043f\u0435\u0440\u0435\u0434<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043d\u0430\u0431\u043e\u0440\u0435 \u0430\u0433\u0435\u043d\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0432\u043f\u0435\u0440\u0435\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d<\/p>\n<\/li>\n<li>\n<p>\u0410\u0433\u0435\u043d\u0442 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043a\u0430\u043a\u0438\u043c \u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430, \u043a\u0440\u043e\u043c\u0435 \u043a\u0430\u043a \u0447\u0435\u0440\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 API, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043d\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b, \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f\u043c\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-memory-model\" rel=\"noopener noreferrer nofollow\">29 Memory Model<\/a>, \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 SEQ-CST \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0431\u044b\u043b\u0438\u00a0<em>observable<\/em>\u00a0\u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432.<\/p>\n<h3>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 Event loop \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 HTML \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u043c?<\/h3>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f Event loop \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 HTML<\/a>. \u041d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0445 \u0436\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u0432\u0441\u0435 \u043e\u043d\u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043d\u0430 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f (\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0435\u0442\u0438). \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435, \u043e\u043f\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e HTML<\/a>, \u0434\u0430\u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u044b, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<p>\u0421\u0447\u0438\u0442\u0430\u0442\u044c \u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e HTML \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0439 \u0432 \u0447\u0430\u0441\u0442\u0438 Event loop &#8212; \u0432\u043e\u043f\u0440\u043e\u0441 \u0441\u043f\u043e\u0440\u043d\u044b\u0439. \u041e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442 \u043d\u0435\u0442, \u043d\u043e, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435, \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0441 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439.<\/p>\n<h3>\u041e\u0431\u044b\u0447\u043d\u043e, \u043f\u0440\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b Event loop, \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 JavaScript.<\/h3>\n<p>\u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0440\u0430\u043d\u0435\u0435,\u00a0<strong>Event loop<\/strong>\u00a0\u043d\u0435 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u043e\u043b\u0435 \u044f\u0437\u044b\u043a\u0430 JavaScript. \u0414\u043b\u044f JavaScript &#8212; \u044d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c (&#171;\u0441\u0435\u0440\u0432\u0438\u0441&#187;, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0441\u0430\u043c\u00a0<strong>Event loop<\/strong>\u00a0\u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c JS-\u043a\u043e\u0434\u0430. \u0412 \u0437\u043e\u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438\u00a0<strong>Event loop<\/strong>\u00a0\u043b\u0435\u0436\u0438\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 (\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043c\u044b\u0448\u0438 \u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0444\u0430\u0439\u043b\u0430, \u0438 \u043f\u0440.), \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433, \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<h3>\u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 Event loop \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c?<\/h3>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439. \u0427\u0443\u0442\u044c \u0432\u044b\u0448\u0435 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-forward-progress\" rel=\"noopener noreferrer nofollow\">9.9 Forward Progress<\/a>\u00a0\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u0433\u0435\u043d\u0442\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c &#8212; \u043d\u0435\u0442. \u041d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445. \u0422\u0430\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u044f\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0430\u0433\u0435\u043d\u0442.<\/p>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0442\u0430\u043a \u0438 \u0435\u0441\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0432 Node.js, \u043f\u0440\u044f\u043c\u043e \u0437\u0430\u044f\u0432\u043b\u044f\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445\u00a0<strong>Event loop<\/strong>\u00a0\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e \u0438\u043b\u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<p>\u0421 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c\u0438 \u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u0442\u043e\u0438\u0442 \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#agents-and-agent-clusters\" rel=\"noopener noreferrer nofollow\">8.1.2 Agents and agent clusters<\/a>\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f HTML<\/a>\u00a0\u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043e\u0432 \u0430\u0433\u0435\u043d\u0442\u043e\u0432<\/p>\n<ul>\n<li>\n<p><strong>Similar-origin window agent<\/strong>\u00a0&#8212; \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Window, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 (\u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/browsers.html#dom-document-domain\" rel=\"noopener noreferrer nofollow\">document.domain)<\/a><\/p>\n<\/li>\n<li>\n<p><strong>Dedicated worker agent<\/strong>\u00a0&#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/workers.html#dedicatedworkerglobalscope\" rel=\"noopener noreferrer nofollow\">DedicatedWorkerGlobalScope<\/a>\u00a0(\u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u044f\u0432\u043d\u044b\u0439\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/web-messaging.html#messageport\" rel=\"noopener noreferrer nofollow\">MessagePort<\/a>)<\/p>\n<\/li>\n<li>\n<p><strong>Shared worker agent<\/strong>\u00a0&#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/workers.html#sharedworkerglobalscope\" rel=\"noopener noreferrer nofollow\">SharedWorkerGlobalScope<\/a>\u00a0(\u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438\u043c\u0435\u044e\u0449\u0430\u044f\u00a0<code>constructor origin<\/code>,\u00a0<code>constructor url<\/code>\u00a0\u0438\u00a0<code>credentials<\/code>)<\/p>\n<\/li>\n<li>\n<p><strong>Service worker agent<\/strong>\u00a0&#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d\u00a0<a href=\"https:\/\/w3c.github.io\/ServiceWorker\/#serviceworkerglobalscope\" rel=\"noopener noreferrer nofollow\">ServiceWorkerGlobalScope<\/a>\u00a0(\u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438\u043c\u0435\u044e\u0449\u0430\u044f \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439\u00a0<a href=\"https:\/\/w3c.github.io\/ServiceWorker\/#dfn-service-worker\" rel=\"noopener noreferrer nofollow\">service worker<\/a>)<\/p>\n<\/li>\n<li>\n<p><strong>Worklet agent<\/strong>\u00a0&#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/worklets.html#workletglobalscope\" rel=\"noopener noreferrer nofollow\">WorkletGlobalScope<\/a>\u00a0(\u0442.\u043a. \u0432\u043e\u0440\u043a\u043b\u0435\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c ES \u043c\u043e\u0434\u0443\u043b\u0438, \u0434\u0430\u043d\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#module-map\" rel=\"noopener noreferrer nofollow\">module map<\/a>)<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0438\u0434\u0430 \u0430\u0433\u0435\u043d\u0442\u0430, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0440\u0438 \u0442\u0438\u043f\u0430\u00a0<strong>Event loop<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>window event loop<\/strong>\u00a0&#8212; \u0434\u043b\u044f\u00a0<strong>similar-origin window agent<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>worker event loop<\/strong>\u00a0&#8212; \u0434\u043b\u044f\u00a0<strong>dedicated worker agent<\/strong>,\u00a0<strong>shared worker agent<\/strong>\u00a0\u0438\u00a0<strong>service worker agent<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>worklet event loop<\/strong>\u00a0&#8212; \u0434\u043b\u044f\u00a0<strong>worklet agent<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0437 \u044d\u0442\u0438\u0445 \u0442\u0440\u0435\u0445,\u00a0<strong>worker event loop<\/strong>\u00a0\u0438\u00a0<strong>worklet event loop<\/strong>\u00a0\u0438\u043c\u0435\u044e\u0442 \u0444\u043b\u0430\u0433 \u0430\u0433\u0435\u043d\u0442\u0430\u00a0<code>[[CanBlock]]<\/code>\u00a0\u0440\u0430\u0432\u043d\u044b\u043c\u00a0<code>true<\/code>, \u0447\u0442\u043e \u043e\u0431\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-forward-progress\" rel=\"noopener noreferrer nofollow\">9.9 Forward Progress<\/a>, \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0442\u0435\u043d\u043d\u043e, \u0442\u0430\u043a\u0438\u0435 Event loop \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0432 \u0441\u0432\u043e\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e,\u00a0<strong>window event loop<\/strong>\u00a0\u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u0431\u043e\u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043c\u043e\u0433\u0443\u0442 \u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a, \u0435\u0441\u043b\u0438 \u0442\u043e\u0433\u043e \u043f\u043e\u0436\u0435\u043b\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430).<\/p>\n<h3>\u0427\u0430\u0441\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e Event loop \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 macrotasks \u0438 microtasks, \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e?<\/h3>\n<p>\u041d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u0430\u043a. \u041f\u043e\u043d\u044f\u0442\u0438\u044f\u00a0<u>macrotask<\/u>\u00a0\u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\u00a0<strong>Event loop<\/strong>\u00a0\u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>, \u043f\u0440\u0438 \u0447\u0435\u043c \u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0437\u0432\u0430\u043d\u0438\u0435,\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u044c\u044e, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u044d\u0442\u043e\u00a0<a href=\"https:\/\/infra.spec.whatwg.org\/#ordered-set\" rel=\"noopener noreferrer nofollow\">set<\/a>. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043a\u0430\u043a\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>\u00a0&#8212; \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, \u0432\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0447 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u0445. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u00a0<a href=\"https:\/\/infra.spec.whatwg.org\/#queue\" rel=\"noopener noreferrer nofollow\">queue<\/a>\u00a0\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0438\u0437\u044a\u044f\u0442\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (<a href=\"https:\/\/infra.spec.whatwg.org\/#queue-dequeue\" rel=\"noopener noreferrer nofollow\">dequeue<\/a>). \u041e\u0434\u043d\u0430\u043a\u043e, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#concept-task-runnable\" rel=\"noopener noreferrer nofollow\">runnable<\/a>\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#concept-task\" rel=\"noopener noreferrer nofollow\">task<\/a>\u00a0\u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041f\u0440\u043e\u0446\u0435\u0441\u0441, \u0432\u043c\u0435\u0441\u0442\u043e\u00a0<a href=\"https:\/\/infra.spec.whatwg.org\/#queue-dequeue\" rel=\"noopener noreferrer nofollow\">dequeue<\/a>\u00a0\u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#concept-task-runnable\" rel=\"noopener noreferrer nofollow\">runnable<\/a>\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#concept-task\" rel=\"noopener noreferrer nofollow\">task<\/a>\u00a0\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0435\u0451 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u00a0<a href=\"https:\/\/infra.spec.whatwg.org\/#queue\" rel=\"noopener noreferrer nofollow\">queue<\/a>. \u041c\u0438\u043a\u0440\u043e\u0442\u0430\u0441\u043a\u0438 \u0436\u0435, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0438\u0437 \u043d\u0435\u0451 \u0432 \u0442\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0438 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u043f\u0430\u043b\u0438. \u0414\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0438\u0436\u0435.<\/p>\n<h3>\u0427\u0442\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 task queue?<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043a\u043e\u0433\u043d\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u0434\u0438\u0441\u0441\u043e\u043d\u0430\u043d\u0441. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b,\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">queue<\/a>\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447, \u0442.\u0435. \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041d\u043e \u0447\u0442\u043e \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c? \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c, \u0441\u0442\u043e\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0439\u0442\u0438 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 JavaScript (\u043c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e\u00a0<strong>Event loop<\/strong>\u00a0\u043b\u0435\u0436\u0438\u0442 \u0437\u0430 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438) \u0438 \u043e\u0441\u043e\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, JS-\u043a\u043e\u0434 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 &#8212; \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0430 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0420\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0432 \u0444\u0430\u0439\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438\u043b\u0438\u00a0<code>&lt;script><\/code>\u00a0\u0442\u044d\u0433, \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0442\u0438\u043f\u0430\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#queue-a-global-task\" rel=\"noopener noreferrer nofollow\">global task<\/a>\u00a0\u0432\u00a0<strong>Event loop<\/strong>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0432\u043e\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438\u00a0<strong>Event loop<\/strong>\u00a0\u0432 \u0432\u0438\u0434\u0435 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043f\u043e \u043c\u0435\u0440\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u043e\u0442 \u0436\u0435\u00a0<strong>Event loop<\/strong>.<\/p>\n<p>\u0427\u0442\u043e \u0435\u0449\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a><\/p>\n<ul>\n<li>\n<p><strong>\u0421\u043e\u0431\u044b\u0442\u0438\u044f<\/strong>\u00a0&#8212; \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>, \u043d\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. \u0415\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u00a0<code>MouseEvent<\/code>\u00a0\u0438\u00a0<code>KeyboardEvent<\/code>\u00a0\u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u044a\u0435\u0434\u0435\u043d\u0435\u043d\u044b \u0432 \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443,\u00a0<code>source<\/code>\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d \u0441\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#user-interaction-task-source\" rel=\"noopener noreferrer nofollow\">user interaction task source<\/a><\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0430\u0440\u0441\u0438\u043d\u0433<\/strong>\u00a0&#8212;\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/parsing.html#html-parser\" rel=\"noopener noreferrer nofollow\">HTML parser<\/a>\u00a0\u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0439\u0442, \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043b\u0431\u044d\u043a\u0438<\/strong>\u00a0&#8212; \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>, \u044d\u0442\u043e \u0436\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0438 \u043a \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443\u00a0<code>setTimeout(() => {})<\/code>, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u00a0<code>setTimeout<\/code>\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0431\u044d\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0442\u0430\u043d\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0432\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a><\/p>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u043f\u0440\u043e\u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/strong>\u00a0&#8212; \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f), \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a><\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 DOM<\/strong>\u00a0&#8212; \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 DOM. \u041a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 DOM \u0441\u043f\u0440\u043e\u0432\u043e\u0446\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430 \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u0430 microtask queue, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c task queue \u0438 \u0447\u0442\u043e \u0432 \u043d\u0435\u0451 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442?<\/h3>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>, \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u0434\u0430\u0447 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u043f\u043b\u0435\u0447\u0430\u0445 \u0430\u0433\u0435\u043d\u0442\u0430. \u0420\u0430\u0431\u043e\u0442\u0430 \u0436\u0435 c\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>\u00a0&#8212; \u044d\u0442\u043e, \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u043e\u043f\u0446\u0438\u044f, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 Web API, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438. \u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438, \u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0431\u0443\u0434\u044c \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 JS-\u043a\u043e\u0434\u0430, \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u044f HTML \u0442\u0435\u043a\u0441\u0442\u0430, \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 \u0438\u043b\u0438 \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0435\u0449\u0435, \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>\u00a0\u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0438\u0445 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043e JavaScript, \u044f\u0437\u044b\u043a, \u0432 \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043d\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u044b\u0445\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 HTML<\/a>. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u0438, \u043a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c &#8212;\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-promise-objects\" rel=\"noopener noreferrer nofollow\">Promise<\/a>. \u0415\u0441\u043b\u0438 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c, \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-promise-resolve-functions\" rel=\"noopener noreferrer nofollow\">27.2.1.3.2 Promise Resolve Functions<\/a>\u00a0\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u0438\u0441\u0430. \u0428\u0430\u0433 15 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-hostenqueuepromisejob\" rel=\"noopener noreferrer nofollow\">HostEnqueuePromiseJob<\/a>, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f, \u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#job\" rel=\"noopener noreferrer nofollow\">Jobs<\/a>\u00a0\u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432 \u0442\u043e\u043c \u0436\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u044b\u043b\u0438 \u0432\u044b\u0437\u0432\u0430\u043d\u044b, \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0432\u0448\u0438\u0435 \u0438\u0445\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-hostenqueuepromisejob\" rel=\"noopener noreferrer nofollow\">HostEnqueuePromiseJobs<\/a>.<\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438, \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0432\u043e\u043f\u0440\u043e\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0446\u0438\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-hostenqueuepromisejob\" rel=\"noopener noreferrer nofollow\">HostEnqueuePromiseJob<\/a>, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u0441\u043e\u0432\u0435\u0441\u0442\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f. \u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0443\u0442\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>\u00a0\u0437\u0432\u0443\u0447\u0438\u0442 \u043a\u0440\u0430\u0439\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e. \u041d\u043e, \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438, \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u043e\u0434\u043d\u043e \u0438\u0437 \u0441\u0430\u043c\u044b \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 JS-\u0434\u0432\u0438\u0436\u043a\u043e\u0432 &#8212;\u00a0<a href=\"https:\/\/v8.dev\/\" rel=\"noopener noreferrer nofollow\">V8<\/a>\u00a0(\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u0432\u0438\u0436\u043a\u0430\u00a0<a href=\"https:\/\/chromium.googlesource.com\/v8\/v8\/+\/refs\/tags\/12.3.55\" rel=\"noopener noreferrer nofollow\">12.3.55<\/a>)<\/p>\n<p><a href=\"https:\/\/chromium.googlesource.com\/v8\/v8\/+\/refs\/tags\/12.3.55\/src\/objects\/objects.cc\" rel=\"noopener noreferrer nofollow\">\/src\/objects\/object<\/a><a href=\"https:\/\/chromium.googlesource.com\/v8\/v8\/+\/refs\/tags\/12.3.55\/src\/objects\/objects.cc#4839\" rel=\"noopener noreferrer nofollow\">s.cc#4839<\/a><\/p>\n<pre><code class=\"cpp\">\/\/ https:\/\/tc39.es\/ecma262\/#sec-promise-resolve-functions \/\/ static MaybeHandle&lt;Object> JSPromise::Resolve(Handle&lt;JSPromise> promise,                                        Handle&lt;Object> resolution) {   \/\/...   \/\/...   \/\/...    \/\/ 13. Let job be NewPromiseResolveThenableJob(promise, resolution,   \/\/                                             thenAction).   Handle&lt;NativeContext> then_context;   if (!JSReceiver::GetContextForMicrotask(Handle&lt;JSReceiver>::cast(then_action))            .ToHandle(&amp;then_context)) {     then_context = isolate->native_context();   }    Handle&lt;PromiseResolveThenableJobTask> task =       isolate->factory()->NewPromiseResolveThenableJobTask(           promise, Handle&lt;JSReceiver>::cast(resolution),           Handle&lt;JSReceiver>::cast(then_action), then_context);   if (isolate->debug()->is_active() &amp;&amp; IsJSPromise(*resolution)) {     \/\/ Mark the dependency of the new {promise} on the {resolution}.     Object::SetProperty(isolate, resolution,                         isolate->factory()->promise_handled_by_symbol(),                         promise)         .Check();   }   MicrotaskQueue* microtask_queue = then_context->microtask_queue();   if (microtask_queue) microtask_queue->EnqueueMicrotask(*task);      \/\/ 15. Return undefined.   return isolate->factory()->undefined_value(); }<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 V8 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-hostenqueuepromisejob\" rel=\"noopener noreferrer nofollow\">HostEnqueuePromiseJob<\/a>, \u0434\u0432\u0438\u0436\u043e\u043a \u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask\" rel=\"noopener noreferrer nofollow\">microtask<\/a>\u00a0\u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>, \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044f, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u043d\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h3>\u041a\u0430\u043a, \u0432\u0441\u0435 \u0442\u0430\u043a\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c Event loop? \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438?<\/h3>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 HTML<\/a>, \u0430 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 API \u0442\u043e\u0439 \u041e\u0421, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f. \u0418\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0441\u0442\u043e\u0438\u0442 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u0430\u0445 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430, \u0430 \u0442\u0430\u043a \u0436\u0435, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445 \u0438 \u041e\u0421 API. \u0412 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>, \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0432 \u0441\u0430\u043c\u043e\u0439 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 (<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>\u00a0\u0438\u043c\u0435\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434). \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0430\u0434\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u0430\u0431\u044b \u043d\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u043f\u0441\u0435\u0432\u0434\u043e-\u0432\u0435\u0440\u0441\u0438\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430. \u0420\u0430\u0437 \u0443\u0436 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 JavaScript, \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Typescript.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b\u00a0<strong>Event loop<\/strong>, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b. \u042d\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0442\u0438\u0438 \u0441\u043e\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 HTML<\/a>\u00a0\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f. \u0421\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u00a0<strong>Event loop<\/strong>\u00a0\u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0434\u0430\u043b\u0435\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"typescript\">\/** * A browsing context is a programmatic representation of a series of documents, multiple of which can live within a * single navigable. Each browsing context has a corresponding WindowProxy object, as well as the following: * * - An `opener browsing context`, a browsing context or null, initially null. * - An `opener origin` at creation, an origin or null, initially null. * - An `is popup` boolean, initially false. * - An `is auxiliary` boolean, initially false. * - An `initial UR`L, a URL or null, initially null. * - A `virtual browsing context group ID` integer, initially 0. This is used by cross-origin opener policy reporting, *   to keep track of the browsing context group switches that would have happened if the report-only policy had been *   enforced. * * A browsing context's active window is its WindowProxy object's [[Window]] internal slot value. A browsing context's * active document is its active window's associated Document. * * A browsing context's top-level traversable is its active document's node navigable's top-level traversable. * * A browsing context whose is auxiliary is true is known as an auxiliary browsing context. Auxiliary browsing contexts * are always top-level browsing contexts. * * Note: For a demonstration purposes and for simplicity the BrowserContext is reflecting the Window interface which is *       not fully correct, as the might be different implementations of the BrowserContext. *\/ interface BrowsingContext extends  Window {}    \/**  * A navigation request is a request whose destination is \"document\", \"embed\", \"frame\", \"iframe\", or \"object\"  *  * Note: For a demonstration purposes and for simplicity the NavigationRequest is reflecting the Window interface  *       which is not correct as the NavigationRequest is a different structure mostly use for  *       `Handle Fetch` (https:\/\/w3c.github.io\/ServiceWorker\/#handle-fetch)  *\/ interface NavigationRequest extends Window {}    interface Environment {   id: string;   creationURL: URL;   topLevelCreationURL: URL;   topLevelOrigin: string | null;   targetBrowsingContext: BrowsingContext | NavigationRequest | null;   activeServiceWorker: ServiceWorker | null;   executionReady: boolean; }  interface EnvironmentSettingsObjects extends Environment {   realmExecutionContext: ExecutionContext;   moduleMap: ModuleMap;   apiBaseURL: URL;   origin: string;   policyContainer: PolicyContainer;   crossOriginIsolatedCapability: boolean;   timeOrigin: number; }  interface Task {   \/\/ A series of steps specifying the work to be done by the task.   \/\/ will be defined in a certain Task implementation   steps: Steps;      \/\/ One of the task sources, used to group and serialize related tasks.   \/\/   \/\/ Per its source field, each task is defined as coming from a specific task source. For each event loop, every   \/\/ task source must be associated with a specific task queue.   \/\/   \/\/ Essentially, task sources are used within standards to separate logically-different types of tasks,   \/\/ which a user agent might wish to distinguish between. Task queues are used by user agents to coalesce task sources   \/\/ within a given event loop.   source: unknown;      \/\/ A Document associated with the task, or null for tasks that are not in a window event loop.   \/\/ A task is runnable if its document is either null or fully active.   document: Document | null;      \/\/ A set of environment settings objects used for tracking script evaluation during the task.   environmentSettingsObject: Set&lt;EnvironmentSettingsObjects>; }  interface GlobalTask extends Task {   steps: Steps; \/\/ redefine\/implement steps for this particular task type }  interface EventLoop {   taskQueue: Set&lt;Task>;      \/\/ Each event loop has a microtask queue, which is a queue of microtasks, initially empty. A microtask is a colloquial   \/\/ way of referring to a task that was created via the queue a microtask algorithm.   \/\/   \/\/ For microtaskQueue is used just to illustrate that the specification supposes it to be a logical queue, rather   \/\/ than a set of tasks. From technical perspective, a real implementation might use a `Set` like for taskQueue, or   \/\/ any other structure at the discretion of the agent's developer.   microtaskQueue: Array&lt;Task>;      \/\/ Each event loop has a currently running task, which is either a task or null. Initially, this is null. It is used   \/\/ to handle reentrancy.   currentRunningTask: Task | null;      \/\/ Each event loop has a performing a microtask checkpoint boolean, which is initially false. It is used to prevent   \/\/ reentrant invocation of the perform a microtask checkpoint algorithm.   performingAMicrotaskCheckpoint: boolean; }  interface WindowEventLoop extends EventLoop {   \/\/ Each window event loop has a DOMHighResTimeStamp last render opportunity time, initially set to zero.   lastRenderOpportunityTime: number;      \/\/ Each window event loop has a DOMHighResTimeStamp last idle period start time, initially set to zero.   lastIdlePeriodStartTime: number; }  \/** Just for demonstration purposes. Such a helper not necessarily should be presented in the real implementation *\/ function isWindowEventLoop(eventLoop: EventLoop): eventLoop is WindowEventLoop {   return 'lastRenderOpportunityTime' in eventLoop &amp;&amp; 'lastIdlePeriodStartTime' in eventLoop; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0442\u0443 \u0447\u0430\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043d\u0438\u0436\u0435). \u0422\u0435\u043f\u0435\u0440\u044c, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u00a0<strong>Event loop<\/strong>. \u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0441\u0442\u043e\u0438\u0442 \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#event-loop-processing-model\" rel=\"noopener noreferrer nofollow\">8.1.7.3 Processing model<\/a>\u00a0\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435.<\/p>\n<pre><code class=\"typescript\">\/**  * Processing the event loop according to the `8.1.7.3 Processing model`  * https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#event-loop-processing-model  *\/ function runEventLoop(eventLoop: EventLoop) {   \/\/ 1. Let oldestTask and taskStartTime be null.   let oldestTask: Task | null = null;   let taskStartTime: number | null = null;       while (true) {     \/\/ 2. check if the taskQueue has a runnable task and if there is one     \/\/   2.1. Let taskQueue be one such task queue, chosen in an implementation-defined manner.     \/\/   2.2. ... will be done below     \/\/   2.3. Set oldestTask to the first runnable task in taskQueue, and remove it from taskQueue.     oldestTask = getFirstRunnableTaskFromQueueAndRemove(eventLoop.taskQueue);           if (oldestTask !== null) {       \/\/ 2.2. Set taskStartTime to the unsafe shared current time.       taskStartTime = Date.now();               \/\/ 2.4. Set the event loop's currently running task to oldestTask.       eventLoop.currentRunningTask = oldestTask;               \/\/ 2.5. Perform oldestTask's steps.       performTaskSteps(oldestTask.steps);               \/\/ 2.6. Set the event loop's currently running task back to null.       eventLoop.currentRunningTask = null;               \/\/ 2.7. Perform a microtask checkpoint.       performMicrotaskCheckpoint(eventLoop);     }           \/\/ 3. Let hasARenderingOpportunity be false.     let hasARenderingOpportunity = false;           \/\/ 4. Let `now` be the unsafe shared current time.     let now = Date.now();           \/\/ 5. If oldestTask is not null, then:     if (oldestTask !== null) {       \/\/ 5.1. Let top-level browsing contexts be an empty set.       const topLevelBrowsingContexts = new Set();               \/\/ 5.2. For each environment settings object settings of oldestTask's script evaluation       \/\/      environment settings object set:       oldestTask.environmentSettingsObject.forEach((settingsObject) => {               \/\/ 5.2.1. Let `global` be settings's global object.       const global = settingsObject.targetBrowsingContext;               \/\/ 5.2.2. If `global` is not a Window object, then continue.       if (!(global instanceof Window)) {         return;       }               \/\/ 5.2.3. If global's browsing context is null, then continue.       if (!global.document) {         return;       }               \/\/ 5.2.4. Let tlbc be global's browsing context's top-level browsing context.       const tlbc = global.document;               \/\/ 5.2.5. If tlbc is not null, then append it to top-level browsing contexts.       if (tlbc !== null) {         topLevelBrowsingContexts.add(tlbc)       }     });           \/\/ 5.3. Report long tasks, passing in taskStartTime, now (the end time of the task), top-level browsing contexts,     \/\/      and oldestTask.     \/\/      https:\/\/w3c.github.io\/longtasks\/#report-long-tasks     \/\/ ...   }       \/\/ 6. if this is a window event loop, then: Update the rendering   if (isWindowEventLoop(eventLoop)) {     updateRendering(eventLoop);   }       \/\/ 7. If all of the following are true:   \/\/   - this is a window event loop;   \/\/   - there is no task in this event loop's task queues whose document is fully active;   \/\/   - this event loop's microtask queue is empty; and   \/\/   - hasARenderingOpportunity is false,   \/\/ then:   \/\/   ...run computeDeadline and hasPendingRenders steps for WindowEventLoop       \/\/ 8. If this is a WorkerEventLoop, then:   \/\/   ...run animation frame callbacks and update the rendering of that dedicated worker }<\/code><\/pre>\n<p>\u0427\u0430\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0448\u0430\u0433\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#perform-a-microtask-checkpoint\" rel=\"noopener noreferrer nofollow\">2.7 Perform a microtask checkpoint<\/a>\u00a0<em>, <\/em>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432\u044b\u043d\u0435\u0441\u043b\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e<em>\u00a0<\/em><code>performMicrotaskCheckpoint<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"typescript\">\/** Finds and returns the first runnable task in the queue. The found Task will be removed from the queue *\/ function getFirstRunnableTaskFromQueueAndRemove(taskQueue: Set&lt;Task>): Task | null {   \/\/...   return null; }  \/** Performs Task steps *\/ function performTaskSteps(steps: Steps) {   \/\/... }  \/**  * Performs a microtask checkpoint  * https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#perform-a-microtask-checkpoint  *\/ function performMicrotaskCheckpoint(eventLoop: EventLoop) {   \/\/ 1. If the event loop's performing a microtask checkpoint is true, then return.   if (eventLoop.performingAMicrotaskCheckpoint) {     return;   }      \/\/ 2. Set the event loop's performing a microtask checkpoint to true.   eventLoop.performingAMicrotaskCheckpoint = true;      \/\/ 3. While the event loop's microtask queue is not empty:   while (eventLoop.microtaskQueue.length > 0) {     \/\/ 3.1. Let oldestMicrotask be the result of dequeuing from the event loop's microtask queue.     const oldestMicrotask = eventLoop.microtaskQueue.shift();          \/\/ 3.2. Set the event loop's currently running task to oldestMicrotask.     eventLoop.currentRunningTask = oldestMicrotask;          \/\/ 3.3. Run oldestMicrotask.     performTaskSteps(oldestMicrotask.steps);          \/\/ 3.4. Set the event loop's currently running task back to null.     eventLoop.currentRunningTask = null;   }      \/\/ 4. For each environment settings object whose responsible event loop is this event loop, notify about rejected   \/\/    promises on that environment settings object.   \/\/ ...      \/\/ 5. Cleanup Indexed Database transactions.   \/\/ ...      \/\/ 6. Perform ClearKeptObjects().   \/\/ ...      \/\/ 7. Set the event loop's performing a microtask checkpoint to false.   eventLoop.performingAMicrotaskCheckpoint = false; }  \/**  * Runs `Update the rendering` steps for WindowEventLoop  * https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#update-the-rendering  *\/ function updateRendering(eventLoop: WindowEventLoop) {   \/\/ ... reveal that Document   \/\/ ... flush autofocus candidates for that Document   \/\/ ... run the resize steps for that Document   \/\/ ... run the scroll steps for that Document   \/\/ ... evaluate media queries and report changes for that Document   \/\/ ... update animations and send events for that Document   \/\/ ... run the fullscreen steps for that Document   \/\/ ... run the animation frame callbacks for that Document   \/\/ ... if the focused area of that Document is not a focusable area, then run the focusing steps for that   \/\/     Document's viewport   \/\/ ... perform pending transition operations for that Document   \/\/ ... run the update intersection observations steps for that Document   \/\/ ... invoke the mark paint timing algorithm   \/\/ ... update the rendering or user interface of that Document and its node navigable   \/\/ ... run process top layer removals given Document. }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0420\u0435\u0437\u044e\u043c\u0438\u0440\u0443\u044f \u0432\u044b\u0448\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e<\/h3>\n<p>\u0421\u0430\u043c\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u00a0<strong>Event loop<\/strong>, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0435 \u0437\u043e\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>.<\/p>\n<p>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f Event loop \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e HTML<\/a>, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0430\u043c\u0438, \u043b\u0438\u0431\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438\u043b\u0438 \u0441\u0430\u043c\u0438\u0445\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u0439, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0430\u043c\u0438.<\/p>\n<p>\u0412 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>\u00a0\u0435\u0441\u0442\u044c \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0441\u044b\u043b\u043a\u0438 \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u0441\u00a0<strong>Event loop<\/strong>, \u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430 \u0441\u043e\u0432\u0435\u0441\u0442\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f.<\/p>\n<p><strong>Event loop<\/strong>\u00a0\u043d\u0435 \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435 JavaScript \u043a\u043e\u0434\u0430. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, JavaScript &#8212; \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0438\u043f\u043e\u0432 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432\u00a0<strong>Event loop<\/strong>. \u041f\u043e \u043c\u0438\u043c\u043e JavaScript, \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0441\u044e\u0434\u0430 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0442\u043e\u043a\u0435\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e HTML \u0442\u0435\u043a\u0441\u0442\u0430, \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430, \u043d\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435, \u0438 \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e.<\/p>\n<p><strong>Event loop<\/strong>, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 HTML<\/a>, \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0442\u0430\u043a\u043e\u0432\u044b\u043c \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u00a0<strong>Event loop<\/strong>\u00a0\u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c, \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432 \u043e\u0434\u043d\u0443 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0430\u0433\u0435\u043d\u0442\u043e\u043c \u0431\u044b\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438.<\/p>\n<p><strong>Event loop<\/strong>\u00a0\u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>. \u0412\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438, \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0435\u043c,\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>\u00a0&#8212; \u044d\u0442\u043e \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Web API \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f \u0441 \u0446\u0435\u043b\u044c\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0441\u0432\u043e\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043f\u043e\u0434\u0437\u0430\u0434\u0430\u0447.<\/p>\n<hr\/>\n<p>\u042d\u0442\u0443 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u0430\u043a \u0436\u0435, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432 \u043c\u043e\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0435:<\/p>\n<p>RU:\u00a0<a href=\"https:\/\/t.me\/frontend_almanac_ru\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/frontend_almanac_ru<\/a><br \/>EN:\u00a0<a href=\"https:\/\/t.me\/frontend_almanac\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/frontend_almanac<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/789572\/\"> https:\/\/habr.com\/ru\/articles\/789572\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0435\u0442\u0438 \u0435\u0441\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u00a0<strong>Event loop<\/strong>\u00a0\u0438 \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u043e\u0432\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u0438 \u043f\u043e \u0441\u0435\u0439 \u0434\u0435\u043d\u044c, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435. \u041e\u0434\u043d\u0430\u043a\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0432 \u044d\u0442\u0438\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0439. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0447\u0435\u043c, \u0441\u0430\u043c\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043e\u0431\u0440\u043e\u0441\u043b\u043e \u0440\u044f\u0434\u043e\u043c \u043c\u0438\u0444\u043e\u0432 \u0438 \u0434\u043e\u0433\u0430\u0434\u043e\u043a. \u041f\u043e\u0440\u043e\u0439, \u0434\u0430\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u0430\u043b\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u043e\u043f\u044b\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0433\u0434\u0435 \u0438\u0441\u0442\u0438\u043d\u0430, \u0430 \u0433\u0434\u0435, \u0447\u0438\u0441\u0442\u043e\u0439 \u0432\u043e\u0434\u044b, \u0432\u044b\u043c\u044b\u0441\u0435\u043b.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0433\u0434\u0435 \u0436\u0435, \u0432\u0441\u0435 \u0442\u0430\u043a\u0438, \u0438\u0441\u0442\u0438\u043d\u0430. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0438\u043b\u0438 \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0441\u0432\u043e\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0438 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0441\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f \u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h3>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 Event loop \u0432 JavaScript?<\/h3>\n<p>\u041f\u043e\u043d\u044f\u0442\u0438\u0435\u00a0<strong>Event loop<\/strong>\u00a0\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u042d\u0442\u043e \u0444\u0430\u043a\u0442. \u041d\u043e \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>\u00a0\u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043c. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u00a0<strong>Event loop<\/strong>\u00a0\u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u044f\u0437\u044b\u043a\u0430\u00a0<strong>JavaScript (ECMAScript)<\/strong>\u00a0\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439. \u042d\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0432\u0438\u0436\u043a\u0430 JavaScript \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<strong>Event loop<\/strong>\u00a0\u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 API \u0441\u0440\u0435\u0434\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<h3>\u0427\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f Event loop?<\/h3>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438 \u0432\u044b\u0448\u0435, \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>\u00a0\u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0439 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u00a0<strong>Event loop<\/strong>, \u0442.\u043a. \u043e\u043d\u043e \u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0435 \u0437\u043e\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430, \u043d\u043e \u0432 \u0437\u043e\u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442 JavaScript \u043a\u043e\u0434. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u0441\u043a\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431\u00a0<strong>Event loop<\/strong>\u00a0\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u0445, \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0445, \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0438\u043b\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f. \u0422\u0430\u043a\u0438\u0445 \u0441\u0440\u0435\u0434, \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e. \u0423\u0441\u043b\u043e\u0432\u043d\u043e, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b: \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0438 \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435.<\/p>\n<h4>\u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b<\/h4>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u043a\u0438\u0445 \u0441\u0440\u0435\u0434 \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f WHATWG \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 HTML<\/a>.<\/p>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u00a0<strong>Event loop<\/strong>\u00a0\u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#event-loops\" rel=\"noopener noreferrer nofollow\">8.1.7 Event loops<\/a>. \u041e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u0445\u00a0<strong>Event loop<\/strong>\u00a0\u0432 Web API \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435. \u041f\u043e\u043a\u0430 \u0443\u043f\u043e\u043c\u044f\u043d\u0443 \u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0442 API \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Chromium \u0432 MacOS \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/nsrunloop\" rel=\"noopener noreferrer nofollow\">NSRunLoop<\/a>, \u0430 \u0432 Linux &#8212; \u043d\u0430\u00a0<a href=\"https:\/\/docs.gtk.org\/glib\/\" rel=\"noopener noreferrer nofollow\">glib<\/a>.<\/p>\n<p>\u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0437\u0434\u0435\u0441\u044c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Electron, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0438\u043b\u0443 \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u0440\u043e\u0441\u0441-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\u00a0<strong>Event loop<\/strong>\u00a0\u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u041e\u0421 \u0438 \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 Node.js (\u043e\u0431 \u044d\u0442\u043e\u043c \u0434\u0430\u043b\u044c\u0448\u0435).<\/p>\n<h4>\u041d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b<\/h4>\n<p>\u0422\u0430\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u044b, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 HTML<\/a>. \u0418, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432 \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 (\u043a\u0440\u043e\u043c\u0435\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>), \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0430\u043a\u0438\u0435 \u0441\u0440\u0435\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e.<\/p>\n<p>\u0421\u0430\u043c\u043e\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439, \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c, \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<a href=\"https:\/\/nodejs.org\/api\/all.html\" rel=\"noopener noreferrer nofollow\">Node.js<\/a>.<\/p>\n<p>\u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Node.js (\u0432\u0435\u0440\u0441\u0438\u044f Node.js v21.6.1 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438) \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<a href=\"https:\/\/nodejs.org\/api\/all.html#all_n-api_libuv-event-loop\" rel=\"noopener noreferrer nofollow\">libuv even loop<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u0432 Node API, \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u00a0<code>napi_get_uv_event_loop<\/code>, \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439\u00a0<strong>Event loop<\/strong>.<\/p>\n<p>\u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f\u00a0<strong>Event loop<\/strong>\u00a0\u044d\u0442\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435 \u0434\u0430\u0435\u0442. \u041d\u043e \u0438\u0437 \u043d\u0435\u0451 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043d\u043e\u0433\u043e, Node.js \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f Node.js, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e\u00a0<strong>Event loop<\/strong>\u00a0\u0432 \u044d\u0442\u043e\u0439 \u0441\u0440\u0435\u0434\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u0431\u0438\u0431\u0438\u043b\u043e\u0442\u0435\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438. \u0412\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b API\u00a0<a href=\"http:\/\/docs.libuv.org\/en\/v1.x\/loop.html\" rel=\"noopener noreferrer nofollow\">uv_loop_t<\/a>, \u0434\u0430\u044e\u0449\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e API \u0432 \u0447\u0430\u0441\u0442\u0438\u00a0<strong>Event loop<\/strong>. \u0422\u0430\u043a \u0436\u0435, \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f\u00a0<a href=\"http:\/\/docs.libuv.org\/en\/v1.x\/design.html\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b Event loop<\/a>, \u0438\u00a0<a href=\"http:\/\/docs.libuv.org\/en\/v1.x\/guide\/basics.html#event-loops\" rel=\"noopener noreferrer nofollow\">\u0433\u0430\u0439\u0434<\/a>\u00a0\u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0<strong>Event loop<\/strong>\u00a0\u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<p>\u041a \u0434\u0440\u0443\u0433\u0438\u043c \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438\u00a0<a href=\"https:\/\/deno.com\/\" rel=\"noopener noreferrer nofollow\">Deno<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/bun.sh\/\" rel=\"noopener noreferrer nofollow\">Bun<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>\u00a0\u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0<strong>Event loop<\/strong>.<\/p>\n<p>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b, \u0442\u0430\u043a\u0438\u0435, \u043a\u0430\u043a\u00a0<a href=\"https:\/\/reactnative.dev\/\" rel=\"noopener noreferrer nofollow\">React Native<\/a>,\u00a0<a href=\"https:\/\/nativescript.org\/\" rel=\"noopener noreferrer nofollow\">NativeScript<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/cordova.apache.org\/\" rel=\"noopener noreferrer nofollow\">Apache Cordova<\/a>\u00a0\u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c\u0438. \u041e\u043d\u0438 \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 API \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u041e\u0421, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f Andriod \u044d\u0442\u043e\u00a0<a href=\"https:\/\/developer.android.com\/reference\/android\/os\/Looper\" rel=\"noopener noreferrer nofollow\">Android.os.Looper<\/a>, \u0430 \u0434\u043b\u044f iOS &#8212;\u00a0<a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/runloop\/\" rel=\"noopener noreferrer nofollow\">RunLoop<\/a>.<\/p>\n<h3>\u041d\u043e \u0432\u0435\u0434\u044c \u0431\u0435\u0437 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 Event loop, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 JavaScript-\u043a\u043e\u0434\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0440\u0430\u0439\u043d\u0435 \u0442\u0440\u0443\u0434\u043d\u043e. \u041a\u0430\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f ECMA-262 \u043c\u043e\u0433\u043b\u0430 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0432\u0430\u0436\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c?<\/h3>\n<p>\u041d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u044f Event loop \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>\u00a0\u043d\u0435\u0442, \u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430. \u041d\u043e \u0440\u0435\u0433\u043b\u0430\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u044d\u0442\u0430 \u043d\u0435 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0435\u043d\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u0438. \u0412\u043e\u043e\u0431\u0449\u0435, \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f JavaScript \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u0446\u0435\u043b\u044b\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-executable-code-and-execution-contexts\" rel=\"noopener noreferrer nofollow\">9 Executable Code and Execution Contexts<\/a>. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432 \u043f.\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-agents\" rel=\"noopener noreferrer nofollow\">9.7 Agents<\/a>, \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u0435\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#agent\" rel=\"noopener noreferrer nofollow\">Agent<\/a>, \u0447\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#agent-record\" rel=\"noopener noreferrer nofollow\">Agent Record<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u043b\u044f, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0435 \u0437\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0433\u0435\u043d\u0442\u0430 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043e\u0432\u0435\u0441\u0442\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#host\" rel=\"noopener noreferrer nofollow\">HOST<\/a>-\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f, \u043e\u0434\u043d\u0430\u043a\u043e, \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f.\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-forward-progress\" rel=\"noopener noreferrer nofollow\">9.9 Forward Progress<\/a>\u00a0\u0438\u0437\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0433\u0435\u043d\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>\u0410\u0433\u0435\u043d\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0433\u0435\u043d\u0442, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u0435 ActiveRecord\u00a0<code>[[CanBlock]]<\/code>\u00a0\u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0<code>true<\/code><\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0430\u0433\u0435\u043d\u0442\u043e\u043c \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0433\u0435\u043d\u0442 \u0441 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0438\u0442\u043e\u0433\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0432\u043f\u0435\u0440\u0435\u0434<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043d\u0430\u0431\u043e\u0440\u0435 \u0430\u0433\u0435\u043d\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0432\u043f\u0435\u0440\u0435\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d<\/p>\n<\/li>\n<li>\n<p>\u0410\u0433\u0435\u043d\u0442 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043a\u0430\u043a\u0438\u043c \u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430, \u043a\u0440\u043e\u043c\u0435 \u043a\u0430\u043a \u0447\u0435\u0440\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 API, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043d\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b, \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f\u043c\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-memory-model\" rel=\"noopener noreferrer nofollow\">29 Memory Model<\/a>, \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 SEQ-CST \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0431\u044b\u043b\u0438\u00a0<em>observable<\/em>\u00a0\u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432.<\/p>\n<h3>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 Event loop \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 HTML \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u044b\u043c?<\/h3>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f Event loop \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 HTML<\/a>. \u041d\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u0445 \u0436\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u0432\u0441\u0435 \u043e\u043d\u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043d\u0430 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f (\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0435\u0442\u0438). \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435, \u043e\u043f\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e HTML<\/a>, \u0434\u0430\u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u044b, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<p>\u0421\u0447\u0438\u0442\u0430\u0442\u044c \u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e HTML \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0439 \u0432 \u0447\u0430\u0441\u0442\u0438 Event loop &#8212; \u0432\u043e\u043f\u0440\u043e\u0441 \u0441\u043f\u043e\u0440\u043d\u044b\u0439. \u041e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442 \u043d\u0435\u0442, \u043d\u043e, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435, \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0441 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439.<\/p>\n<h3>\u041e\u0431\u044b\u0447\u043d\u043e, \u043f\u0440\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b Event loop, \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 JavaScript.<\/h3>\n<p>\u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0440\u0430\u043d\u0435\u0435,\u00a0<strong>Event loop<\/strong>\u00a0\u043d\u0435 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u043e\u043b\u0435 \u044f\u0437\u044b\u043a\u0430 JavaScript. \u0414\u043b\u044f JavaScript &#8212; \u044d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c (&#171;\u0441\u0435\u0440\u0432\u0438\u0441&#187;, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0441\u0430\u043c\u00a0<strong>Event loop<\/strong>\u00a0\u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c JS-\u043a\u043e\u0434\u0430. \u0412 \u0437\u043e\u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438\u00a0<strong>Event loop<\/strong>\u00a0\u043b\u0435\u0436\u0438\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 (\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043c\u044b\u0448\u0438 \u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0444\u0430\u0439\u043b\u0430, \u0438 \u043f\u0440.), \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433, \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<h3>\u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 Event loop \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c?<\/h3>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439. \u0427\u0443\u0442\u044c \u0432\u044b\u0448\u0435 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-forward-progress\" rel=\"noopener noreferrer nofollow\">9.9 Forward Progress<\/a>\u00a0\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438\u00a0<a href=\"https:\/\/tc39.es\/ecma262\" rel=\"noopener noreferrer nofollow\">ECMA-262<\/a>, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u0433\u0435\u043d\u0442\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c &#8212; \u043d\u0435\u0442. \u041d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445. \u0422\u0430\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u044f\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0430\u0433\u0435\u043d\u0442.<\/p>\n<p>\u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0442\u0430\u043a \u0438 \u0435\u0441\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u00a0<a href=\"https:\/\/libuv.org\/\" rel=\"noopener noreferrer nofollow\">libuv<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0432 Node.js, \u043f\u0440\u044f\u043c\u043e \u0437\u0430\u044f\u0432\u043b\u044f\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445\u00a0<strong>Event loop<\/strong>\u00a0\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e \u0438\u043b\u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<p>\u0421 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u044b\u043c\u0438 \u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u0442\u043e\u0438\u0442 \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#agents-and-agent-clusters\" rel=\"noopener noreferrer nofollow\">8.1.2 Agents and agent clusters<\/a>\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f HTML<\/a>\u00a0\u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043e\u0432 \u0430\u0433\u0435\u043d\u0442\u043e\u0432<\/p>\n<ul>\n<li>\n<p><strong>Similar-origin window agent<\/strong>\u00a0&#8212; \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Window, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 (\u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/browsers.html#dom-document-domain\" rel=\"noopener noreferrer nofollow\">document.domain)<\/a><\/p>\n<\/li>\n<li>\n<p><strong>Dedicated worker agent<\/strong>\u00a0&#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/workers.html#dedicatedworkerglobalscope\" rel=\"noopener noreferrer nofollow\">DedicatedWorkerGlobalScope<\/a>\u00a0(\u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u044f\u0432\u043d\u044b\u0439\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/web-messaging.html#messageport\" rel=\"noopener noreferrer nofollow\">MessagePort<\/a>)<\/p>\n<\/li>\n<li>\n<p><strong>Shared worker agent<\/strong>\u00a0&#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/workers.html#sharedworkerglobalscope\" rel=\"noopener noreferrer nofollow\">SharedWorkerGlobalScope<\/a>\u00a0(\u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438\u043c\u0435\u044e\u0449\u0430\u044f\u00a0<code>constructor origin<\/code>,\u00a0<code>constructor url<\/code>\u00a0\u0438\u00a0<code>credentials<\/code>)<\/p>\n<\/li>\n<li>\n<p><strong>Service worker agent<\/strong>\u00a0&#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d\u00a0<a href=\"https:\/\/w3c.github.io\/ServiceWorker\/#serviceworkerglobalscope\" rel=\"noopener noreferrer nofollow\">ServiceWorkerGlobalScope<\/a>\u00a0(\u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0438\u043c\u0435\u044e\u0449\u0430\u044f \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439\u00a0<a href=\"https:\/\/w3c.github.io\/ServiceWorker\/#dfn-service-worker\" rel=\"noopener noreferrer nofollow\">service worker<\/a>)<\/p>\n<\/li>\n<li>\n<p><strong>Worklet agent<\/strong>\u00a0&#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/worklets.html#workletglobalscope\" rel=\"noopener noreferrer nofollow\">WorkletGlobalScope<\/a>\u00a0(\u0442.\u043a. \u0432\u043e\u0440\u043a\u043b\u0435\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c ES \u043c\u043e\u0434\u0443\u043b\u0438, \u0434\u0430\u043d\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#module-map\" rel=\"noopener noreferrer nofollow\">module map<\/a>)<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0438\u0434\u0430 \u0430\u0433\u0435\u043d\u0442\u0430, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0440\u0438 \u0442\u0438\u043f\u0430\u00a0<strong>Event loop<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>window event loop<\/strong>\u00a0&#8212; \u0434\u043b\u044f\u00a0<strong>similar-origin window agent<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>worker event loop<\/strong>\u00a0&#8212; \u0434\u043b\u044f\u00a0<strong>dedicated worker agent<\/strong>,\u00a0<strong>shared worker agent<\/strong>\u00a0\u0438\u00a0<strong>service worker agent<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>worklet event loop<\/strong>\u00a0&#8212; \u0434\u043b\u044f\u00a0<strong>worklet agent<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0437 \u044d\u0442\u0438\u0445 \u0442\u0440\u0435\u0445,\u00a0<strong>worker event loop<\/strong>\u00a0\u0438\u00a0<strong>worklet event loop<\/strong>\u00a0\u0438\u043c\u0435\u044e\u0442 \u0444\u043b\u0430\u0433 \u0430\u0433\u0435\u043d\u0442\u0430\u00a0<code>[[CanBlock]]<\/code>\u00a0\u0440\u0430\u0432\u043d\u044b\u043c\u00a0<code>true<\/code>, \u0447\u0442\u043e \u043e\u0431\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u00a0<a href=\"https:\/\/tc39.es\/ecma262\/#sec-forward-progress\" rel=\"noopener noreferrer nofollow\">9.9 Forward Progress<\/a>, \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0442\u0435\u043d\u043d\u043e, \u0442\u0430\u043a\u0438\u0435 Event loop \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0432 \u0441\u0432\u043e\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e,\u00a0<strong>window event loop<\/strong>\u00a0\u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u0431\u043e\u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043c\u043e\u0433\u0443\u0442 \u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a, \u0435\u0441\u043b\u0438 \u0442\u043e\u0433\u043e \u043f\u043e\u0436\u0435\u043b\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430).<\/p>\n<h3>\u0427\u0430\u0441\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e Event loop \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 macrotasks \u0438 microtasks, \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e?<\/h3>\n<p>\u041d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u0430\u043a. \u041f\u043e\u043d\u044f\u0442\u0438\u044f\u00a0<u>macrotask<\/u>\u00a0\u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.\u00a0<strong>Event loop<\/strong>\u00a0\u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>, \u043f\u0440\u0438 \u0447\u0435\u043c \u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0437\u0432\u0430\u043d\u0438\u0435,\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u044c\u044e, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u044d\u0442\u043e\u00a0<a href=\"https:\/\/infra.spec.whatwg.org\/#ordered-set\" rel=\"noopener noreferrer nofollow\">set<\/a>. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043a\u0430\u043a\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#microtask-queue\" rel=\"noopener noreferrer nofollow\">microtask queue<\/a>\u00a0&#8212; \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, \u0432\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0447 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u0445. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u00a0<a href=\"https:\/\/infra.spec.whatwg.org\/#queue\" rel=\"noopener noreferrer nofollow\">queue<\/a>\u00a0\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0438\u0437\u044a\u044f\u0442\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (<a href=\"https:\/\/infra.spec.whatwg.org\/#queue-dequeue\" rel=\"noopener noreferrer nofollow\">dequeue<\/a>). \u041e\u0434\u043d\u0430\u043a\u043e, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#task-queue\" rel=\"noopener noreferrer nofollow\">task queue<\/a>\u00a0\u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#concept-task-runnable\" rel=\"noopener noreferrer nofollow\">runnable<\/a>\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#concept-task\" rel=\"noopener noreferrer nofollow\">task<\/a>\u00a0\u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041f\u0440\u043e\u0446\u0435\u0441\u0441, \u0432\u043c\u0435\u0441\u0442\u043e\u00a0<a href=\"https:\/\/infra.spec.whatwg.org\/#queue-dequeue\" rel=\"noopener noreferrer nofollow\">dequeue<\/a>\u00a0\u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#concept-task-runnable\" rel=\"noopener noreferrer nofollow\">runnable<\/a>\u00a0<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/webappapis.html#concept-task\" rel=\"noopener noreferrer nofollow\">task<\/a>\u00a0\u0438<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-366558","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/366558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=366558"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/366558\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=366558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=366558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=366558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}