{"id":408020,"date":"2024-06-29T19:54:33","date_gmt":"2024-06-29T19:54:33","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=408020"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=408020","title":{"rendered":"<span>\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u0444 \u043d\u0430 RxJS<\/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>\u041d\u0430 \u0434\u043d\u044f\u0445 \u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043a\u0438\u043d\u043e, \u0433\u0434\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u0444. \u041e\u043d \u0437\u043d\u0430\u043b \u043d\u0430\u0438\u0437\u0443\u0441\u0442\u044c \u0430\u0437\u0431\u0443\u043a\u0443 \u041c\u043e\u0440\u0437\u0435 \u0438 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u043b \u0441\u0432\u043e\u044e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443. \u042f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f: \u0441 RxJS \u043c\u044b \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u0435! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0438\u043b\u0438\u043c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u0444, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 fromEvent \u0438 \u043c\u0430\u0441\u0441\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0442\u0440\u044e\u043a\u043e\u0432. \u041f\u043e\u0442\u0440\u0435\u043d\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0441 Dependency Injection, \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430\u043c\u0438 \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 RxJS, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u0435\u043c\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0440\u0443\u0442\u043e \u0438 \u0437\u0432\u0443\u0447\u0438\u0442 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0447\u043d\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/532\/28e\/087\/53228e0873ba5c6f6b4a9ef235bc8ebc.png\" width=\"1600\" height=\"903\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/532\/28e\/087\/53228e0873ba5c6f6b4a9ef235bc8ebc.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0410\u0437\u0431\u0443\u043a\u0430 \u041c\u043e\u0440\u0437\u0435<\/h2>\n<p>\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u0444 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0430\u0437\u0431\u0443\u043a\u043e\u0439 \u041c\u043e\u0440\u0437\u0435. \u0414\u043b\u044f \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0432 \u043d\u0435\u0439 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0421\u0438\u0433\u043d\u0430\u043b \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0439: \u043e\u043d \u0440\u0430\u0437\u0431\u0438\u0442 \u043d\u0430 \u043a\u0443\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u2014 \u043b\u0438\u0431\u043e \u043f\u0438\u0441\u043a, \u043b\u0438\u0431\u043e \u0442\u0438\u0448\u0438\u043d\u0430. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Boolean<\/code> \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e <strong>1<\/strong> \u0438 <strong>0<\/strong> \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438. \u0410\u0437\u0431\u0443\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c:<\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430: <em>\u0442\u043e\u0447\u043a\u0430<\/em> \u0438 <em>\u0442\u0438\u0440\u0435<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u0442\u0438\u0440\u0435 \u2014 <strong>\u0442\u0440\u0438<\/strong> \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043f\u043e\u0434\u0440\u044f\u0434;<\/p>\n<\/li>\n<li>\n<p>\u0442\u043e\u0447\u043a\u0430 \u2014 <strong>\u043e\u0434\u043d\u0430<\/strong> \u0435\u0434\u0438\u043d\u0438\u0446\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0440\u0430\u0437\u0431\u0438\u0442\u044b <strong>\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u043c \u043d\u0443\u043b\u0435\u043c<\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0431\u0443\u043a\u0432\u044b \u0440\u0430\u0437\u0431\u0438\u0442\u044b <strong>\u0442\u0440\u0435\u043c\u044f \u043d\u0443\u043b\u044f\u043c\u0438<\/strong> \u043f\u043e\u0434\u0440\u044f\u0434;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043b\u043e\u0432\u0430 \u0440\u0430\u0437\u0431\u0438\u0442\u044b <strong>\u0441\u0435\u043c\u044c\u044e \u043d\u0443\u043b\u044f\u043c\u0438<\/strong> \u043f\u043e\u0434\u0440\u044f\u0434. \u041f\u0440\u0438\u043c\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u0435\u043b \u2014 \u0447\u0435\u0442\u044b\u0440\u0435 \u043d\u0443\u043b\u044f \u0438 \u0442\u0440\u0438 \u043d\u0443\u043b\u044f \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u043a\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0438\u0436\u0435. \u041c\u044b \u0432\u0438\u0434\u0438\u043c \u0448\u0430\u0433 \u0441\u0435\u0442\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u0427\u0435\u0440\u043d\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0440\u0430\u0432\u0435\u043d \u0435\u0434\u0438\u043d\u0438\u0446\u0435, \u0431\u0435\u043b\u044b\u0439 \u2014 \u043d\u0443\u043b\u044e:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/922\/96c\/917\/92296c917bd1b633464cd2db4cbf0724.png\" width=\"512\" height=\"197\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/922\/96c\/917\/92296c917bd1b633464cd2db4cbf0724.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0431\u0443\u043a\u0432\u0443 \u00abH\u00bb, \u044d\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u043e\u0447\u043a\u0438. \u0422\u043e\u0447\u043a\u0430 \u2014 \u043e\u0434\u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0430, \u0438 \u0442\u043e\u0447\u043a\u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044b \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u043c \u043d\u0443\u043b\u0435\u043c: <strong>1010101<\/strong>. \u0424\u0440\u0430\u0437\u0430 HELLO WORLD \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p><strong>1010101<\/strong>000<strong>1<\/strong>000<strong>101110101<\/strong>000<strong>101110101<\/strong>000<strong>11101110111<\/strong>0000000 = HELLO[\u043a\u043e\u043d\u0435\u0446 \u0441\u043b\u043e\u0432\u0430]<\/p>\n<p><strong>101110111<\/strong>000<strong>11101110111<\/strong>000<strong>1011101<\/strong>000<strong>101110101<\/strong>000<strong>1110101<\/strong>0000000 = WORLD[\u043a\u043e\u043d\u0435\u0446 \u0441\u043b\u043e\u0432\u0430]<\/p>\n<p>\u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u0421\u0428\u0410, \u043d\u043e \u0432 \u043c\u0438\u0440\u0435 \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438: \u0432 Angular \u044d\u0442\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u0442\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/angular.io\/api\/core\/InjectionToken\"><u>InjectionToken<\/u><\/a>. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0441\u043c\u043e\u0433\u0443\u0442 \u0435\u0435 \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<pre><code class=\"dart\">export const MAP = new InjectionToken&lt;Map&lt;string, readonly (0 | 1)[]>>(   'Morse code dictionary',   {     factory: () => new Map([       [' ', [0, 0, 0, 0]],       ['a', [1, 0, 1, 1, 1]],       \/\/ ...     ])   }, )<\/code><\/pre>\n<p>\u041c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043b\u044e\u0434\u0435\u0439 \u043d\u0430\u0436\u0438\u043c\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u043a\u043d\u043e\u043f\u043a\u0443 \u2014 \u043f\u0443\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443, \u0430 \u043c\u044b \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0431\u0443\u043a\u0432\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u043f\u043e \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0439 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u0444\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0438, \u043c\u044b \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u0443\u0435\u043c \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u0434\u043d\u043e\u0433\u043e <code>fromEvent(document, 'keydown')<\/code> \u0438 \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u0438\u043c \u044d\u0442\u043e\u0442 <code>Observable<\/code> \u043f\u043e \u043f\u043e\u043b\u043d\u043e\u0439!<\/p>\n<h2>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u041a\u0430\u0436\u0434\u0443\u044e \u0431\u0443\u043a\u0432\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e. \u0411\u0443\u043a\u0432\u044b \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u044f\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0446. \u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043d\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u043f\u043e\u0434 \u0448\u0430\u0433 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<blockquote>\n<p><em>\u041f\u0443\u0441\u0442\u044c \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 InjectionToken, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043c\u0435\u043d\u044f\u0442\u044c.<\/em><\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0431\u0443\u043a\u0432\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u044f\u0442\u0441\u044f \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0438\u043c\u0435\u044e\u0449\u0438\u0435 <strong>\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/strong> \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0438 \u043d\u0435 \u0442\u0435\u0440\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c <code>concatMap<\/code>. \u041e\u043d \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e <a href=\"https:\/\/blog.angular-university.io\/rxjs-higher-order-mapping\/\"><u>Higher Order Observable<\/u><\/a> \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043c \u043a\u0430\u0436\u0434\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 <code>Observable<\/code>. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0430\u043b \u043a\u043b\u0430\u0432\u0438\u0448\u0443), <code>concatMap<\/code> \u0434\u043e\u0436\u0434\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 <code>Observable<\/code> \u0437\u0430\u043a\u043e\u043c\u043f\u043b\u0438\u0442\u0438\u0442\u0441\u044f. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u044b\u0433\u0440\u0430\u0435\u0442 \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>Observable<\/code> \u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0422\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043d\u0435 \u0431\u043e\u044f\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0431\u0443\u043a\u0432\u044b \u043f\u0440\u043e\u043f\u0430\u0434\u0443\u0442 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0449\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u044d\u0442\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043c \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u044d\u043a\u0440\u0430\u043d\u043d\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"dart\">@Injectable({   providedIn: 'root', }) export class MorseService extends Subject&lt;readonly (0 | 1)[]> {   constructor(     @Inject(MAP) private readonly chars: Map&lt;string, readonly (0 | 1)[]>,   ) {     super();   }    send(char: string) {     this.next(this.chars.get(char));   } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u043a\u0435\u043d, \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0431\u0443\u043a\u0432\u044b \u0432 \u0430\u0437\u0431\u0443\u043a\u0443 \u041c\u043e\u0440\u0437\u0435. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0448\u0430\u0433\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432\u0441\u0435 <code>keydown<\/code>-\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0430 <code>document<\/code> \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0438\u0445 \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>concatMap<\/code> \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0432\u0441\u0435 \u0432 \u043f\u043e\u0442\u043e\u043a \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0446. \u041a\u0430\u0436\u0434\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043c \u0442\u0440\u0435\u043c\u044f \u043d\u0443\u043b\u044f\u043c\u0438:<\/p>\n<pre><code class=\"dart\">export const MORSE = new InjectionToken&lt;Observable&lt;0 | 1>(   'A sequence of Morse code',    {     factory: () => {       const chars = inject(MAP);       const duration = inject(UNIT);       const service$ = inject(MorseService);       const keydown$ = fromEvent(inject(DOCUMENT), 'keydown').pipe(         map(({ key }: KeyboardEvent) => chars.get(key)),         filter(Boolean),       );        return merge(service$, keydown$).pipe(         concatMap(sequence =>           from(sequence).pipe(             endWith(...SPACE),             delayEach(duration),           )         ),         share(),       );     }   } );<\/code><\/pre>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>from<\/code>, \u0430 \u043d\u0435 <code>of<\/code>. \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 <code>from<\/code> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0445 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043c\u0438\u0442\u043e\u0432, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a <code>of<\/code> \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043c\u0438\u0442 \u0432\u0441\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<\/blockquote>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>delayEach<\/code>. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043c\u0438\u0442, \u0430 \u043d\u0435 \u0432\u0435\u0441\u044c \u0441\u0442\u0440\u0438\u043c:<\/p>\n<pre><code class=\"dart\">export function delayEach&lt;T>(duration: number): MonoTypeOperatorFunction&lt;T> { \u00a0\u00a0return concatMap(x => of(x).pipe(delay(duration))); }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a, \u0432\u0437\u044f\u0432 \u0442\u043e\u043a\u0435\u043d <code>MORSE<\/code> \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u043d\u0435\u0433\u043e.<\/p>\n<h2>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u0448\u0430\u0433 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435. \u041d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u041f\u043e\u0442\u043e\u043a \u043d\u0430\u0434\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0410 \u0435\u0441\u043b\u0438 \u0432\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u043b\u0430 \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u043b\u0435\u0442\u0435\u043b\u043e \u0442\u0440\u0438 \u043d\u0443\u043b\u044f \u2014 \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0417\u0430\u0442\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u043d\u0430\u0434\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c.<\/p>\n<div class=\"persona\" persona=\"true\"><img decoding=\"async\" persona=\"true\" class=\"image persona__image\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/a70\/46a\/8af\/a7046a8afcd7dd7f241779fe20ef3db3.jpg\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a70\/46a\/8af\/a7046a8afcd7dd7f241779fe20ef3db3.jpg\" data-blurred=\"true\"\/><\/p>\n<h5 class=\"persona__heading\" persona=\"true\">\u041f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0442\u0440\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u044d\u043c\u0438\u0442\u043e\u0432 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0438 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/h5>\n<\/div>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0431\u0443\u043a\u0432. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 <em>\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430<\/em>, <em>\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b<\/em> \u0438 <em>\u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/em>. \u0417\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u044d\u0442\u043e? \u0414\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438. \u041d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041d\u043e \u044d\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438 \u0432 <em>\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435<\/em>, \u0438 \u0432 <em>\u0441\u0435\u0440\u0432\u0438\u0441\u0435<\/em>. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <em>\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 <\/em>\u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u2014 \u0437\u043d\u0430\u0442\u044c \u0431\u0443\u043a\u0432\u0443, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0441\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442:<\/p>\n<pre><code class=\"dart\">@Directive({   selector: '[char]', }) export class CharDirective {   @Input() char = ''; }<\/code><\/pre>\n<p>\u0412 <em>\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 <\/em>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440. \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b\u0448\u0438 \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0438:<\/p>\n<pre><code class=\"dart\">@Component({   selector: '[char]',   templateUrl: 'char.template.html',   styleUrls: ['char.style.less'],   providers: [CharService], }) export class CharComponent {   constructor(     @Inject(CharService) readonly service: Observable&lt;number | string>,     @Inject(CharDirective) readonly directive: CharDirective,     @Inject(MorseService) private readonly emitter: MorseService,   ) {}    @HostListener('click')   onClick() {     this.emitter.send(this.directive.char);   } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0438. \u041c\u044b \u043d\u0435\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0442\u0438\u043f <code>Observable&lt;number | string><\/code>. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u043e\u0442 0 \u0434\u043e 1 \u0438 \u0431\u0443\u043a\u0432\u0443, \u0435\u0441\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u0427\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u0434\u0435\u043c\u043e-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<h2>\u0421\u0435\u0440\u0432\u0438\u0441<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u2014 \u0441\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c. \u041c\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 RxJS-\u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0443. \u0422\u0440\u0443\u0434\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u044b\u0433\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b. \u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u043e\u043d \u043d\u0435\u043e\u0442\u043b\u0438\u0447\u0438\u043c \u043e\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0431\u0443\u043a\u0432\u044b: \u0438 \u0442\u043e \u0438 \u0434\u0440\u0443\u0433\u043e\u0435 \u2014 \u044d\u0442\u043e \u043a\u0443\u0447\u0430 \u043d\u0443\u043b\u0435\u0439 \u043f\u043e\u0434\u0440\u044f\u0434.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439-\u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u043e\u0432. \u041d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <code>Observable<\/code>. \u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0441\u0442\u0440\u0438\u043c, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0430\u0437\u0431\u0443\u043a\u0438 \u041c\u043e\u0440\u0437\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435:<\/p>\n<pre><code class=\"dart\">@Injectable() export class CharService extends Observable&lt;number | string> {   private readonly inner$ = this.morse$.pipe(     \/\/ ...   )    constructor(     @Inject(MORSE) private readonly morse$: Observable&lt;0 | 1>,     @Inject(MAP) private readonly chars: Map&lt;string, readonly (0 | 1)[]>,     @Inject(CharDirective) private readonly directive: CharDirective,   ) {     super(subscriber => this.inner$.subscribe(subscriber));   } }<\/code><\/pre>\n<p>\u041d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0439 <strong>\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e <\/strong>\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u0442\u0442\u0435\u0440, \u0430 \u043d\u0435 read-only \u043f\u0440\u043e\u043f\u0435\u0440\u0442\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <strong>\u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u043f\u0443\u0442\u044b \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b<\/strong>:<\/p>\n<pre><code class=\"dart\">private get sequence(): readonly (0 | 1)[] {   return [...this.chars.get(this.directive.char), ...SPACE]; }<\/code><\/pre>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u043e\u0439, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>@Attribute<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>@Input<\/code> \u2014 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u0431\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435. \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0447\u0435\u0440\u0435\u0437 <code>*ngFor<\/code>, \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u0443\u043a\u0432\u0443.<\/p>\n<\/blockquote>\n<p>\u041d\u0430\u043c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0433\u0435\u0442\u0442\u0435\u0440\u0430. \u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c <code>@tuiPure<\/code> \u0438\u0437 <a href=\"https:\/\/taiga-ui.dev\/\"><u>Taiga UI<\/u><\/a>. \u041c\u044b \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043c \u0432 \u0441\u0432\u043e\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Functions\/get#smart_self-overwriting_lazy_getters\"><u>\u043b\u0435\u043d\u0438\u0432\u044b\u0445 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432<\/u><\/a>. \u042d\u0442\u043e \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442 \u0433\u0435\u0442\u0442\u0435\u0440 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u043e\u043b\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0448\u043b\u043e\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043b\u043d\u043e\u043c \u0438\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438. \u0427\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0447\u0438\u0441\u0442\u044b\u0445 <a href=\"https:\/\/angular.io\/guide\/pipes\"><u>\u043f\u0430\u0439\u043f\u043e\u0432<\/u><\/a> \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0440\u0430\u0432\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"dart\">private isValid(value: number, index: number): boolean {   return this.sequence[index] === value; }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0443\u0441\u043a\u0430\u0442\u044c. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u044d\u0442\u043e \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441, \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0431\u0443\u043a\u0432\u0430:<\/p>\n<pre><code class=\"dart\">private getValue(index: number): number | string {   return this.sequence.length === index + 1      ? this.char      : (index + 2) \/ this.sequence.length; }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<pre><code class=\"dart\">private readonly inner$ = this.morse$.pipe(   takeWhile(this.isValid.bind(this)),   map((_, index) => this.getValue(index)),   startWith(0),   endWith(0),   takeWhile(isNumber, true), )<\/code><\/pre>\n<p>\u0412 \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0432\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <code>takeWhile<\/code>. \u041e\u0434\u0438\u043d \u043e\u0431\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u0438\u043c, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u043b\u0438. \u0412\u0442\u043e\u0440\u043e\u0439 \u043e\u0431\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u043b\u0435\u0442\u0435\u043b\u0430 \u0431\u0443\u043a\u0432\u0430, \u0432\u043d\u0443\u0442\u0440\u0438 <code>isNumber<\/code> \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0442\u0438\u043f\u0430.<\/p>\n<blockquote>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>takeWhile<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0430\u0440\u0443\u0448\u0438\u0432\u0448\u0435\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435.<\/p>\n<\/blockquote>\n<h2>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0441\u0442\u0440\u0438\u043c\u0430<\/h2>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438. \u041e\u0431\u0440\u044b\u0432 \u043f\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 <code>takeWhile<\/code> (\u0431\u0443\u043a\u0432\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0430) \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u0410 \u0432\u043e\u0442 \u043f\u0440\u0438 \u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0431\u0443\u043a\u0432\u044b (\u0442\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0443\u043b\u044f).<\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0439 \u043c\u044b\u0441\u043b\u044c\u044e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>repeatWhen<\/code>. \u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f. \u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u0442\u043e\u043a \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 <code>Observable<\/code>:<\/p>\n<pre><code class=\"dart\">repeatWhen(() => threeZeroes$),<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e <code>repeatWhen<\/code> \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0445. \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0442\u0440\u0438 \u043d\u0443\u043b\u044f, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0435\u0446 \u0431\u0443\u043a\u0432\u044b, \u043c\u043e\u0433\u0443\u0442 \u0443\u0436\u0435 \u043f\u0440\u043e\u0439\u0442\u0438 \u043a \u043c\u043e\u043c\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441\u043b\u0443\u0448\u0430\u0442\u044c <code>threeZeroes$<\/code>.<\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0442\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0443\u043b\u044f. \u042d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <code>scan<\/code>:\u00a0<\/p>\n<pre><code class=\"dart\">export function consecutive&lt;T>(   value: T,   amount: number ): OperatorFunction&lt;T, unknown> {   return pipe(     startWith(...new Array(amount).fill(value)),     scan((result, item) => (item === value ? ++result : 0), 0),     filter(v => v >= amount),   ); }<\/code><\/pre>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u0440\u0435\u0445 \u043d\u0443\u043b\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0442\u0440\u0438\u043c. \u0417\u0430\u0442\u0435\u043c \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0443\u043b\u0438 \u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u0440\u0438 \u0438 \u0431\u043e\u043b\u0435\u0435. \u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0440\u0438 \u043d\u0443\u043b\u044f <em>\u0440\u043e\u0432\u043d\u043e<\/em>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0431\u0435\u043b \u0432\u0441\u0435 \u0441\u043b\u043e\u043c\u0430\u0435\u0442.<\/p>\n<p>\u0418 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0432\u0430 <code>takeWhile<\/code>-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u0431\u0440\u044b\u0432\u0430\u043b <em>\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 <\/em>\u0441\u0442\u0440\u0438\u043c. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0430\u043c \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <code>concatMap<\/code>:<\/p>\n<pre><code class=\"dart\">private readonly inner$ = this.morse$.pipe(   consecutive(0, SPACE.length),   concatMapTo(this.morse$.pipe(     takeWhile(this.isValid.bind(this)),     map((_, index) => this.getValue(index)),     startWith(0),     endWith(0),   )),   takeWhile(isNumber, true),   repeat(), )<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0441\u0442\u0440\u0438\u043c \u043e\u0431\u043e\u0440\u0432\u0435\u0442\u0441\u044f, \u0442\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0443\u043b\u044f \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u044f\u0442. \u0421\u0438\u043c\u0432\u043e\u043b \u043f\u0440\u043e\u0431\u0435\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u0440\u0435\u043b\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u043d\u043e <code>concatMap<\/code> \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0436\u0438\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u0442\u0440\u0438\u043c\u0430, \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 <code>takeWhile<\/code> \u0441\u0431\u0440\u043e\u0441\u0438\u0442 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441.<\/p>\n<h2>\u0414\u0435\u043c\u043e<\/h2>\n<p>\u0412\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u0438 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0411\u0443\u0434\u0435\u043c \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439 \u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \u0422\u0430\u043a\u0436\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0438 \u0441\u0432\u043e\u0435\u0439 \u0431\u0443\u043a\u0432\u044b.<\/p>\n<p>\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u0444 \u0438 \u0430\u0437\u0431\u0443\u043a\u0430 \u041c\u043e\u0440\u0437\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c\u0438 \u0431\u0435\u0437 \u0437\u0432\u0443\u043a\u0430. \u041f\u0440\u043e\u0441\u0442\u0443\u044e \u043f\u0438\u0449\u0430\u043b\u043a\u0443 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Web_Audio_API\"><u>Web Audio API<\/u><\/a> \u0438 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/OscillatorNode\"><u>OscillatorNode<\/u><\/a>. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u043e\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 <a href=\"https:\/\/github.com\/ng-web-apis\/audio\"><u>@ng-web-apis\/audio<\/u><\/a>.<\/p>\n<blockquote>\n<p><em>\u041e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e open-source-\u0438\u043d\u0438\u0446\u0438\u0430\u0442\u0438\u0432\u044b <\/em><strong><em>Web APIs for Angular<\/em><\/strong><em>. \u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043b\u0435\u0433\u043a\u0438\u0445 \u043e\u0431\u0435\u0440\u0442\u043e\u043a \u0434\u043b\u044f \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 Web API, \u0447\u0442\u043e\u0431\u044b \u0438\u0445 \u0431\u044b\u043b\u043e \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 Angular. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, <\/em><a href=\"https:\/\/ng-web-apis.github.io\/\"><em><u>\u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c<\/u><\/em><\/a><em>.<\/em><\/p>\n<\/blockquote>\n<p>\u0421 \u0435\u0435 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0432 \u0433\u0440\u0430\u0444 \u0430\u0443\u0434\u0438\u043e\u043d\u043e\u0434\u043e\u0432:<\/p>\n<pre><code class=\"xml\">&lt;ng-container waOscillatorNode autoplay frequency=\"523\">   &lt;ng-container     waGainNode     gain=\"0\"     [gain]=\"morse$ | async | waAudioParam : 0.02\"   >     &lt;ng-container waAudioDestinationNode>&lt;\/ng-container>   &lt;\/ng-container> &lt;\/ng-container><\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c \u043f\u0438\u0441\u043a \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u0438\u0446 \u0438 \u0437\u0430\u043c\u043e\u043b\u043a\u0430\u0442\u044c \u043d\u0430 \u043d\u0443\u043b\u044f\u0445 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0438 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041a\u043d\u043e\u043f\u043a\u0430 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0442\u043e\u0436\u0435 \u043d\u0435 \u043f\u043e\u0432\u0440\u0435\u0434\u0438\u0442:<\/p>\n<pre><code class=\"xml\">&lt;section>   &lt;button *ngFor=\"let char of chars\" type=\"button\" [char]=\"char\">     {{char}}   &lt;\/button> &lt;\/section> &lt;output>{{ output$ | async }}&lt;\/output> &lt;footer>   &lt;button type=\"reset\" (click)=\"reset$.next()\">Clear&lt;\/button> &lt;\/footer><\/code><\/pre>\n<p>\u041d\u043e \u0433\u0434\u0435 \u0436\u0435 \u0432\u0437\u044f\u0442\u044c <code>output$<\/code>? \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0412\u044b \u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b Angular \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 DI \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u043e\u0432?<\/p>\n<pre><code class=\"dart\">@ViewChildren(CharService) readonly services?: QueryList&lt;Observable&lt;string | number[]>>;<\/code><\/pre>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043e <code>ngAfterViewInit<\/code>-\u0445\u0443\u043a\u0430. \u0421\u043e\u0431\u0435\u0440\u0435\u043c <code>output$<\/code>:<\/p>\n<pre><code class=\"dart\">readonly reset$ = new Subject&lt;void>();  readonly output$ = this.reset$.pipe(   switchMap(() => merge(...this.services.toArray()).pipe(     filter(x => !isNumber(x)),     scan((result, char) => result + char, ''),     startWith(''),   )),   startWith(''), );  ngAfterViewInit() {   this.reset$.next(); }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <code>span<\/code> \u0432 <code>CharComponent<\/code> \u0438 \u0431\u0443\u0434\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u0432\u044b\u0441\u043e\u0442\u043e\u0439 \u0438 \u0446\u0432\u0435\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0432\u0443\u0445 \u0441\u0442\u0440\u0438\u043c\u043e\u0432:<\/p>\n<pre><code class=\"dart\">readonly progress$ = this.service.pipe(   filter(isNumber),   map(value => value * 100), );  readonly pending$ = this.service.pipe(   filter(Boolean),   map(isNumber), );<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u0440\u044e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e CSS-\u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0448\u0430\u0433\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 Ivy \u0432 Angular \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0439\u043d\u0434\u0438\u043d\u0433 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 CSS-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0432\u0435\u0434\u0435\u043c <code>--duration<\/code> \u0438 \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435:<\/p>\n<pre><code class=\"dart\">@Component({   \/\/ ...   host: {     '[style.--tui-duration.ms]': 'unit',   }, }) export class AppComponent implements AfterViewInit {   constructor(     \/\/ ...     @Inject(UNIT) readonly unit: number,   ) {}    \/\/ ... }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u0438 \u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u0432\u0430\u0441 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/stackblitz.com\/edit\/rxjs-telegraph\">\u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442<\/a>!<\/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\/593165\/\"> https:\/\/habr.com\/ru\/articles\/593165\/<\/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>\u041d\u0430 \u0434\u043d\u044f\u0445 \u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043a\u0438\u043d\u043e, \u0433\u0434\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u0444. \u041e\u043d \u0437\u043d\u0430\u043b \u043d\u0430\u0438\u0437\u0443\u0441\u0442\u044c \u0430\u0437\u0431\u0443\u043a\u0443 \u041c\u043e\u0440\u0437\u0435 \u0438 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u043b \u0441\u0432\u043e\u044e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443. \u042f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f: \u0441 RxJS \u043c\u044b \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u0435! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0438\u043b\u0438\u043c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u0444, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 fromEvent \u0438 \u043c\u0430\u0441\u0441\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0442\u0440\u044e\u043a\u043e\u0432. \u041f\u043e\u0442\u0440\u0435\u043d\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0441 Dependency Injection, \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430\u043c\u0438 \u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 RxJS, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u0435\u043c\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0440\u0443\u0442\u043e \u0438 \u0437\u0432\u0443\u0447\u0438\u0442 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0447\u043d\u043e.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0410\u0437\u0431\u0443\u043a\u0430 \u041c\u043e\u0440\u0437\u0435<\/h2>\n<p>\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u0444 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0430\u0437\u0431\u0443\u043a\u043e\u0439 \u041c\u043e\u0440\u0437\u0435. \u0414\u043b\u044f \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0432 \u043d\u0435\u0439 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0421\u0438\u0433\u043d\u0430\u043b \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u044b\u0439: \u043e\u043d \u0440\u0430\u0437\u0431\u0438\u0442 \u043d\u0430 \u043a\u0443\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u2014 \u043b\u0438\u0431\u043e \u043f\u0438\u0441\u043a, \u043b\u0438\u0431\u043e \u0442\u0438\u0448\u0438\u043d\u0430. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Boolean<\/code> \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e <strong>1<\/strong> \u0438 <strong>0<\/strong> \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438. \u0410\u0437\u0431\u0443\u043a\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c:<\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430: <em>\u0442\u043e\u0447\u043a\u0430<\/em> \u0438 <em>\u0442\u0438\u0440\u0435<\/em>;<\/p>\n<\/li>\n<li>\n<p>\u0442\u0438\u0440\u0435 \u2014 <strong>\u0442\u0440\u0438<\/strong> \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043f\u043e\u0434\u0440\u044f\u0434;<\/p>\n<\/li>\n<li>\n<p>\u0442\u043e\u0447\u043a\u0430 \u2014 <strong>\u043e\u0434\u043d\u0430<\/strong> \u0435\u0434\u0438\u043d\u0438\u0446\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0440\u0430\u0437\u0431\u0438\u0442\u044b <strong>\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u043c \u043d\u0443\u043b\u0435\u043c<\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0431\u0443\u043a\u0432\u044b \u0440\u0430\u0437\u0431\u0438\u0442\u044b <strong>\u0442\u0440\u0435\u043c\u044f \u043d\u0443\u043b\u044f\u043c\u0438<\/strong> \u043f\u043e\u0434\u0440\u044f\u0434;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043b\u043e\u0432\u0430 \u0440\u0430\u0437\u0431\u0438\u0442\u044b <strong>\u0441\u0435\u043c\u044c\u044e \u043d\u0443\u043b\u044f\u043c\u0438<\/strong> \u043f\u043e\u0434\u0440\u044f\u0434. \u041f\u0440\u0438\u043c\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u0435\u043b \u2014 \u0447\u0435\u0442\u044b\u0440\u0435 \u043d\u0443\u043b\u044f \u0438 \u0442\u0440\u0438 \u043d\u0443\u043b\u044f \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u043a\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0438\u0436\u0435. \u041c\u044b \u0432\u0438\u0434\u0438\u043c \u0448\u0430\u0433 \u0441\u0435\u0442\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u0427\u0435\u0440\u043d\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0440\u0430\u0432\u0435\u043d \u0435\u0434\u0438\u043d\u0438\u0446\u0435, \u0431\u0435\u043b\u044b\u0439 \u2014 \u043d\u0443\u043b\u044e:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0431\u0443\u043a\u0432\u0443 \u00abH\u00bb, \u044d\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u043e\u0447\u043a\u0438. \u0422\u043e\u0447\u043a\u0430 \u2014 \u043e\u0434\u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0430, \u0438 \u0442\u043e\u0447\u043a\u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044b \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u043c \u043d\u0443\u043b\u0435\u043c: <strong>1010101<\/strong>. \u0424\u0440\u0430\u0437\u0430 HELLO WORLD \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p><strong>1010101<\/strong>000<strong>1<\/strong>000<strong>101110101<\/strong>000<strong>101110101<\/strong>000<strong>11101110111<\/strong>0000000 = HELLO[\u043a\u043e\u043d\u0435\u0446 \u0441\u043b\u043e\u0432\u0430]<\/p>\n<p><strong>101110111<\/strong>000<strong>11101110111<\/strong>000<strong>1011101<\/strong>000<strong>101110101<\/strong>000<strong>1110101<\/strong>0000000 = WORLD[\u043a\u043e\u043d\u0435\u0446 \u0441\u043b\u043e\u0432\u0430]<\/p>\n<p>\u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u0421\u0428\u0410, \u043d\u043e \u0432 \u043c\u0438\u0440\u0435 \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438: \u0432 Angular \u044d\u0442\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u0442\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/angular.io\/api\/core\/InjectionToken\"><u>InjectionToken<\/u><\/a>. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0441\u043c\u043e\u0433\u0443\u0442 \u0435\u0435 \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<pre><code class=\"dart\">export const MAP = new InjectionToken&lt;Map&lt;string, readonly (0 | 1)[]>>(   'Morse code dictionary',   {     factory: () => new Map([       [' ', [0, 0, 0, 0]],       ['a', [1, 0, 1, 1, 1]],       \/\/ ...     ])   }, )<\/code><\/pre>\n<p>\u041c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043b\u044e\u0434\u0435\u0439 \u043d\u0430\u0436\u0438\u043c\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u043a\u043d\u043e\u043f\u043a\u0443 \u2014 \u043f\u0443\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443, \u0430 \u043c\u044b \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0431\u0443\u043a\u0432\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u043f\u043e \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0439 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u0444\u043d\u043e\u0439 \u043b\u0438\u043d\u0438\u0438, \u043c\u044b \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u0443\u0435\u043c \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u0434\u043d\u043e\u0433\u043e <code>fromEvent(document, 'keydown')<\/code> \u0438 \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u0438\u043c \u044d\u0442\u043e\u0442 <code>Observable<\/code> \u043f\u043e \u043f\u043e\u043b\u043d\u043e\u0439!<\/p>\n<h2>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>\u041a\u0430\u0436\u0434\u0443\u044e \u0431\u0443\u043a\u0432\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e. \u0411\u0443\u043a\u0432\u044b \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u044f\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0446. \u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043d\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u043f\u043e\u0434 \u0448\u0430\u0433 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<blockquote>\n<p><em>\u041f\u0443\u0441\u0442\u044c \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 InjectionToken, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043c\u0435\u043d\u044f\u0442\u044c.<\/em><\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0431\u0443\u043a\u0432\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u044f\u0442\u0441\u044f \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0438\u043c\u0435\u044e\u0449\u0438\u0435 <strong>\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/strong> \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0438 \u043d\u0435 \u0442\u0435\u0440\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c <code>concatMap<\/code>. \u041e\u043d \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u043e <a href=\"https:\/\/blog.angular-university.io\/rxjs-higher-order-mapping\/\"><u>Higher Order Observable<\/u><\/a> \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043c \u043a\u0430\u0436\u0434\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 <code>Observable<\/code>. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0430\u043b \u043a\u043b\u0430\u0432\u0438\u0448\u0443), <code>concatMap<\/code> \u0434\u043e\u0436\u0434\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 <code>Observable<\/code> \u0437\u0430\u043a\u043e\u043c\u043f\u043b\u0438\u0442\u0438\u0442\u0441\u044f. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u044b\u0433\u0440\u0430\u0435\u0442 \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>Observable<\/code> \u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0422\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043d\u0435 \u0431\u043e\u044f\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0431\u0443\u043a\u0432\u044b \u043f\u0440\u043e\u043f\u0430\u0434\u0443\u0442 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0449\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u044d\u0442\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043c \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u044d\u043a\u0440\u0430\u043d\u043d\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b:<\/p>\n<pre><code class=\"dart\">@Injectable({   providedIn: 'root', }) export class MorseService extends Subject&lt;readonly (0 | 1)[]> {   constructor(     @Inject(MAP) private readonly chars: Map&lt;string, readonly (0 | 1)[]>,   ) {     super();   }    send(char: string) {     this.next(this.chars.get(char));   } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u043a\u0435\u043d, \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0431\u0443\u043a\u0432\u044b \u0432 \u0430\u0437\u0431\u0443\u043a\u0443 \u041c\u043e\u0440\u0437\u0435. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0448\u0430\u0433\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0432\u0441\u0435 <code>keydown<\/code>-\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0430 <code>document<\/code> \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0438\u0445 \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>concatMap<\/code> \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0432\u0441\u0435 \u0432 \u043f\u043e\u0442\u043e\u043a \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0446. \u041a\u0430\u0436\u0434\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043c \u0442\u0440\u0435\u043c\u044f \u043d\u0443\u043b\u044f\u043c\u0438:<\/p>\n<pre><code class=\"dart\">export const MORSE = new InjectionToken&lt;Observable&lt;0 | 1>(   'A sequence of Morse code',    {     factory: () => {       const chars = inject(MAP);       const duration = inject(UNIT);       const service$ = inject(MorseService);       const keydown$ = fromEvent(inject(DOCUMENT), 'keydown').pipe(         map(({ key }: KeyboardEvent) => chars.get(key)),         filter(Boolean),       );        return merge(service$, keydown$).pipe(         concatMap(sequence =>           from(sequence).pipe(             endWith(...SPACE),             delayEach(duration),           )         ),         share(),       );     }   } );<\/code><\/pre>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>from<\/code>, \u0430 \u043d\u0435 <code>of<\/code>. \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 <code>from<\/code> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0445 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043c\u0438\u0442\u043e\u0432, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a <code>of<\/code> \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043c\u0438\u0442 \u0432\u0441\u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<\/blockquote>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>delayEach<\/code>. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043c\u0438\u0442, \u0430 \u043d\u0435 \u0432\u0435\u0441\u044c \u0441\u0442\u0440\u0438\u043c:<\/p>\n<pre><code class=\"dart\">export function delayEach&lt;T>(duration: number): MonoTypeOperatorFunction&lt;T> { \u00a0\u00a0return concatMap(x => of(x).pipe(delay(duration))); }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a, \u0432\u0437\u044f\u0432 \u0442\u043e\u043a\u0435\u043d <code>MORSE<\/code> \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0441\u044c \u043d\u0430 \u043d\u0435\u0433\u043e.<\/p>\n<h2>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u0448\u0430\u0433 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435. \u041d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u041f\u043e\u0442\u043e\u043a \u043d\u0430\u0434\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0440\u0430\u0432\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0410 \u0435\u0441\u043b\u0438 \u0432\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u043b\u0430 \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u043b\u0435\u0442\u0435\u043b\u043e \u0442\u0440\u0438 \u043d\u0443\u043b\u044f \u2014 \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0431\u0443\u043a\u0432\u0443. \u0417\u0430\u0442\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u043d\u0430\u0434\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c.<\/p>\n<div class=\"persona\" persona=\"true\">\n<h5 class=\"persona__heading\" persona=\"true\">\u041f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0442\u0440\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u044d\u043c\u0438\u0442\u043e\u0432 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0438 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/h5>\n<\/div>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0431\u0443\u043a\u0432. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 <em>\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430<\/em>, <em>\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b<\/em> \u0438 <em>\u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/em>. \u0417\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u044d\u0442\u043e? \u0414\u043b\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438. \u041d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0439 \u0431\u0443\u043a\u0432\u043e\u0439 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041d\u043e \u044d\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438 \u0432 <em>\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435<\/em>, \u0438 \u0432 <em>\u0441\u0435\u0440\u0432\u0438\u0441\u0435<\/em>. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <em>\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 <\/em>\u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u2014 \u0437\u043d\u0430\u0442\u044c \u0431\u0443\u043a\u0432\u0443, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0441\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442:<\/p>\n<pre><code class=\"dart\">@Directive({   selector: '[char]', }) export class CharDirective {   @Input() char = ''; }<\/code><\/pre>\n<p>\u0412 <em>\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 <\/em>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440. \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b\u0448\u0438 \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0438:<\/p>\n<pre><code class=\"dart\">@Component({   selector: '[char]',   templateUrl: 'char.template.html',   styleUrls: ['char.style.less'],   providers: [CharService], }) export class CharComponent {   constructor(     @Inject(CharService) readonly service: Observable&lt;number | string>,     @Inject(CharDirective) readonly directive: CharDirective,     @Inject(MorseService) private readonly emitter: MorseService,   ) {}    @HostListener('click')   onClick() {     this.emitter.send(this.directive.char);   } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0438. \u041c\u044b \u043d\u0435\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0442\u0438\u043f <code>Observable&lt;number | string><\/code>. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u043e\u0442 0 \u0434\u043e 1 \u0438 \u0431\u0443\u043a\u0432\u0443, \u0435\u0441\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u0427\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u0434\u0435\u043c\u043e-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<h2>\u0421\u0435\u0440\u0432\u0438\u0441<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u2014 \u0441\u0430\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c. \u041c\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 RxJS-\u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0443. \u0422\u0440\u0443\u0434\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u044b\u0433\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u0435\u043b. \u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u043e\u043d \u043d\u0435\u043e\u0442\u043b\u0438\u0447\u0438\u043c \u043e\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0431\u0443\u043a\u0432\u044b: \u0438 \u0442\u043e \u0438 \u0434\u0440\u0443\u0433\u043e\u0435 \u2014 \u044d\u0442\u043e \u043a\u0443\u0447\u0430 \u043d\u0443\u043b\u0435\u0439 \u043f\u043e\u0434\u0440\u044f\u0434.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439-\u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u043e\u0432. \u041d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <code>Observable<\/code>. \u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0441\u0442\u0440\u0438\u043c, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0430\u0437\u0431\u0443\u043a\u0438 \u041c\u043e\u0440\u0437\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435:<\/p>\n<pre><code class=\"dart\">@Injectable() export class CharService extends Observable&lt;number | string> {   private readonly inner$ = this.morse$.pipe(     \/\/ ...   )    constructor(     @Inject(MORSE) private readonly morse$: Observable&lt;0 | 1>,     @Inject(MAP) private readonly chars: Map&lt;string, readonly (0 | 1)[]>,     @Inject(CharDirective) private readonly directive: CharDirective,   ) {     super(subscriber => this.inner$.subscribe(subscriber));   } }<\/code><\/pre>\n<p>\u041d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0439 <strong>\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e <\/strong>\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u0442\u0442\u0435\u0440, \u0430 \u043d\u0435 read-only \u043f\u0440\u043e\u043f\u0435\u0440\u0442\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <strong>\u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u043f\u0443\u0442\u044b \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b<\/strong>:<\/p>\n<pre><code class=\"dart\">private get sequence(): readonly (0 | 1)[] {   return [...this.chars.get(this.directive.char), ...SPACE]; }<\/code><\/pre>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u043e\u0439, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>@Attribute<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>@Input<\/code> \u2014 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u0431\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435. \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0447\u0435\u0440\u0435\u0437 <code>*ngFor<\/code>, \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0431\u0443\u043a\u0432\u0443.<\/p>\n<\/blockquote>\n<p>\u041d\u0430\u043c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0433\u0435\u0442\u0442\u0435\u0440\u0430. \u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c <code>@tuiPure<\/code> \u0438\u0437 <a href=\"https:\/\/taiga-ui.dev\/\"><u>Taiga UI<\/u><\/a>. \u041c\u044b \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043c \u0432 \u0441\u0432\u043e\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Functions\/get#smart_self-overwriting_lazy_getters\"><u>\u043b\u0435\u043d\u0438\u0432\u044b\u0445 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432<\/u><\/a>. \u042d\u0442\u043e \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u043c\u0435\u043c\u043e\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442 \u0433\u0435\u0442\u0442\u0435\u0440 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u043e\u043b\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0448\u043b\u043e\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043b\u043d\u043e\u043c \u0438\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438. \u0427\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0447\u0438\u0441\u0442\u044b\u0445 <a href=\"https:\/\/angular.io\/guide\/pipes\"><u>\u043f\u0430\u0439\u043f\u043e\u0432<\/u><\/a> \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u0440\u0430\u0432\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"dart\">private isValid(value: number, index: number): boolean {   return this.sequence[index] === value; }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0443\u0441\u043a\u0430\u0442\u044c. \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u044d\u0442\u043e \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441, \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0431\u0443\u043a\u0432\u0430:<\/p>\n<pre><code class=\"dart\">private getValue(index: number): number | string {   return this.sequence.length === index + 1      ? this.char      : (index + 2) \/ this.sequence.length; }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0435\u0440\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<pre><code class=\"dart\">private readonly inner$ = this.morse$.pipe(   takeWhile(this.isValid.bind(this)),   map((_, index) => this.getValue(index)),   startWith(0),   endWith(0),   takeWhile(isNumber, true), )<\/code><\/pre>\n<p>\u0412 \u043f\u043e\u0442\u043e\u043a\u0435 \u0434\u0432\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <code>takeWhile<\/code>. \u041e\u0434\u0438\u043d \u043e\u0431\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u0438\u043c, \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u043b\u0438. \u0412\u0442\u043e\u0440\u043e\u0439 \u043e\u0431\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u043b\u0435\u0442\u0435\u043b\u0430 \u0431\u0443\u043a\u0432\u0430, \u0432\u043d\u0443\u0442\u0440\u0438 <code>isNumber<\/code> \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0442\u0438\u043f\u0430.<\/p>\n<blockquote>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>takeWhile<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0430\u0440\u0443\u0448\u0438\u0432\u0448\u0435\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435.<\/p>\n<\/blockquote>\n<h2>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0441\u0442\u0440\u0438\u043c\u0430<\/h2>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438. \u041e\u0431\u0440\u044b\u0432 \u043f\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 <code>takeWhile<\/code> (\u0431\u0443\u043a\u0432\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0430) \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u0410 \u0432\u043e\u0442 \u043f\u0440\u0438 \u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0431\u0443\u043a\u0432\u044b (\u0442\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0443\u043b\u044f).<\/p>\n<p>\u041f\u0435\u0440\u0432<\/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-408020","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/408020","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=408020"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/408020\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=408020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=408020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=408020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}