{"id":313436,"date":"2020-11-19T15:01:18","date_gmt":"2020-11-19T15:01:18","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313436"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313436","title":{"rendered":"\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 (dependency injection) \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 JavaScript"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r1\/oy\/vk\/r1oyvktsseijavhy4gyhjqb1zja.jpeg\"><\/p>\n<p>\u0418\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439, \u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 DI npm \u043f\u0430\u043a\u0435\u0442\u0430\u0445. \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u0432\u043e\u0439 DI.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0432 \u043e\u0431 OOP \u0438 DI<\/h2>\n<p>  <\/p>\n<p>\u0422\u0435\u043c\u0443 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u041e\u041e\u041f \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0430\u043c \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0435. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0447\u0435\u0442\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b. \u0421\u0447\u0438\u0442\u0430\u044e ES \u043a\u043b\u0430\u0441\u0441\u044b \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 js \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u041e\u041e\u041f.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0438\u0437 \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430. \u0412 2006 \u0433\u043e\u0434\u0443 \u0431\u044b\u043b \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0435\u043d, \u0447\u0435\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u2014 \u044f\u0437\u044b\u043a PERL. \u041e\u043d \u0433\u0438\u0431\u043a\u0438\u0439. \u042f \u0432 \u0442\u043e\u043c \u0433\u043e\u0434\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0432\u043e\u044e OO \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u044f\u0437\u044b\u043a PERL \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442, \u043f\u0430\u0440\u0430 \u043c\u0430\u043d\u0443\u0430\u043b\u043e\u0432 <a href=\"https:\/\/github.com\/Perl\/perl5\/blob\/blead\/pod\/perlobj.pod\" rel=\"nofollow\">1<\/a>, <a href=\"https:\/\/github.com\/Perl\/perl5\/blob\/blead\/pod\/perlootut.pod\" rel=\"nofollow\">2<\/a>, \u0438 \u0431\u0435\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u0432\u0435\u0440\u043d\u0443\u043b\u0441\u044f \u043a \u044d\u0442\u043e\u0439 \u043f\u043e\u0434\u0435\u043b\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 2 \u043c\u0435\u0441\u044f\u0446\u0430, \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0432\u043e\u044e \u0436\u0435 \u041e\u041e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0434\u0430 \u0438 \u043e\u043d\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0445\u043e\u0440\u043e\u0448\u0435\u0439, \u043a\u0430\u043a \u044f \u0434\u0443\u043c\u0430\u043b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e. \u0415\u0449\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043b\u0433\u043e\u0434\u0430 \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f, \u0438 \u043f\u043e\u043d\u044f\u043b \u0447\u0442\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u0436\u0435 \u043a\u043e\u0434. \u041f\u043b\u044e\u0441 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u044d\u0442\u043e\u0439 \u041e\u041e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u0441\u0435\u0431\u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u044f \u043d\u0430 JavaScript, \u044f \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0412\u0440\u043e\u0434\u0435 \u041e\u041e\u041f \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0448\u044c \u0432\u043e\u043a\u0440\u0443\u0433 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u0438 \u0432\u0441\u0435 \u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>TypeScript \u0442\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u043e \u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u0443 \u043c\u0435\u043d\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0432\u0441\u0435 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0440\u043e\u0432\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043b\u044f\u0441\u043a\u0438 \u0441 \u0431\u0443\u0431\u043d\u043e\u043c \u0431\u044b\u043b\u0438 (\u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e). \u0422\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0440\u043e\u0441\u043b\u043e\u0441\u044c.<\/p>\n<p>  <\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439, \u0447\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 JS \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b JQuery UI Widget Factory. \u041d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0438 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442, \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c. \u0421\u0435\u0439\u0447\u0430\u0441 ES6 classes \u043f\u043e\u0441\u043b\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0430 ES5 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0440\u044b\u0432 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u041e\u041e\u041f. \u0418 \u043f\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044e ES6 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u043e \u043d\u043e\u0432\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445 DI.<\/p>\n<p>  <\/p>\n<p>\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 (dependency injection) \u0441\u0447\u0438\u0442\u0430\u044e \u0432\u0430\u0436\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b \u041e\u041e\u041f. \u0412\u0441\u0435 \u043b\u0435\u0433\u043a\u043e, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0438 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0438 \u0432 \u043d\u0435\u0439 \u0435\u0441\u0442\u044c DI, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0433\u0438\u0431\u043a\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<p>  <\/p>\n<p>DI \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043e\u0442 \u043c\u043e\u043d\u0441\u0442\u0440\u0443\u043e\u0437\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u2014 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0438\u043a. \u0412\u0430\u0440\u0438\u0430\u0446\u0438\u0439, \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e (\u043e\u0434\u0438\u043d\/\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432, \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u0442\u044b, \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u044f\u0437\u044b\u043a, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b&#8230;). \u041f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b\/\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u0440\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0410 \u0435\u0441\u043b\u0438 \u0438 \u0437\u0430\u0445\u043e\u0447\u0435\u0442, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u0432 \u201c\u043c\u043e\u043d\u0441\u0442\u0440\u043e\u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c\u201d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u0431\u043e\u044f\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0437-\u0437\u0430 \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432. \u041d\u043e \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043b\u0435\u0433\u043a\u043e \u0447\u0443\u0442\u043e\u0447\u0435\u043a \u0434\u043e\u043f\u0438\u043b\u0438\u0442\u044c \u043f\u043e\u0434 \u0441\u0435\u0431\u044f \u0438\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u2014 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0438\u043a \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u043c! \u0412\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f DI.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 DI \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0430\u043c\u043e\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u2014 \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u043e\u043c.<\/p>\n<p>  <\/p>\n<h2>\u041f\u043e \u0442\u0435\u043c\u0435 \u0441\u0442\u0430\u0442\u044c\u0438<\/h2>\n<p>  <\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u2014 \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c. Javascript \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435. \u0410 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b \u0443 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c. <\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441 App \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, <\/p>\n<p>  <\/p>\n<p>\u043a\u043b\u0430\u0441\u0441 Storage \u2014 \u043a\u0430\u043a\u043e\u0435 \u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (\u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043d\u0430 \u0432\u0441\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 singleton\/service),<\/p>\n<p>  <\/p>\n<p>\u0438 \u043a\u043b\u0430\u0441\u0441 Date, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u043e\u0439 (\u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u0443\u044e \u0434\u0430\u0442\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440).<\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438-\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u0435\u0434. \u0432\u044b\u0437\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 (transient) \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u201cnew\u201d.<\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438-\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u0434\u0430\u044e\u0449\u0443\u044e \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 (singleton) \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u201cone\u201d.<\/p>\n<pre><code class=\"javascript\">class App {      \/** @type { function( int ):IDate } *\/     newDate;      \/** @type { function(): IStorage } *\/     oneStorage;      construct( newDate, oneStorage ) {         this.newDate = newDate;         this.oneStorage = oneStorage;     }      main() {         const oDate1 = this.newDate( 0 );         const oDate2 = this.newDate( 1000 );         const oStorage = this.oneStorage();         oStorage.insert( oDate1.format() + ' - ' + oDate2.format() );     } } <\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0442\u0435\u043c \u0447\u0442\u043e \u043e\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u0435\u043d. \u0422\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043e (lazy). \u041a\u043e\u0433\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0437 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439, \u043a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 inversify: to, toSelf, toConstantValue, toDynamicValue, toConstructor, toFactory, toFunction, toAutoFactory, toProvider, toService), \u0432\u0441\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f DI \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043d\u0430 \u0440\u043e\u0432\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0432\u0435\u0437\u0434\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>  <\/p>\n<p>\u0427\u0430\u0441\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f DI \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u0434 \u0441\u0430\u043c\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u043b\u0438 \u0441\u0430\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u042f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 DI \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445, \u043d\u0430\u0439\u0442\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0437\u0430\u043e\u0434\u043d\u043e \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0438\u0445 \u0432 \u043d\u0435\u043a\u0443\u044e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443. \u041d\u0438\u0436\u0435 \u043e\u043f\u0438\u0448\u0443 \u043c\u043e\u0438 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 DI \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439.<\/p>\n<h2>\u0420\u0430\u0437\u043d\u044b\u0435 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043a\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f dependency injection<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443, \u0445\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432\u0441\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0437\u043d\u044b\u0435. \u0418 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043e\u043a \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f dependency injection. \u042f \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0432\u0438\u0434\u0435\u043d\u0438\u044e: <\/p>\n<p>  <\/p>\n<ol>\n<li>\u0414\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/li>\n<li>\u0423\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043a\u043b\u044e\u0447\u0438\/\u0442\u043e\u043a\u0435\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c. \u0423\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/li>\n<li>\u0423\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c. \u0423\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c, \u0430\u0432\u0442\u043e\u043a\u043e\u043c\u043f\u043b\u0438\u0442\/\u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f IDE.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041c\u0430\u043b\u043e \u0433\u0434\u0435 \u0443\u0434\u0435\u043b\u044f\u044e\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043e\u0442 DI. \u041d\u043e \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0443 \u043b\u044e\u0431\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e, \u0435\u0441\u043b\u0438 \u0435\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 DI \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438, \u0430 \u043d\u0435 \u0442\u044f\u043d\u0443\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0441\u043e\u0431\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 DI \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u044b. \u041c\u043e\u0436\u043d\u043e \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0447\u0438\u0441\u0442\u044b\u043c, \u0430 \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. \u0414\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043b\u0438\u0431\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u0442\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043b\u0438\u0431\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c DI \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0446\u0438\u0444\u0440\u0430, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439, \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c, \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u043d\u0438\u0436\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0447\u0442\u043e, \u0447\u0442\u043e-\u0442\u043e \u043b\u0443\u0447\u0448\u0435, \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0445\u0443\u0436\u0435, \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0415\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043d\u0443\u0436\u0434. \u0412\u044b\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0435 \u2014 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u201c\u043a\u0443\u043d\u0433-\u0444\u0443\u201d )<\/p>\n<h2>\u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 dependency injection \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 javascript\/typescript<\/h2>\n<p>  <\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u044f \u201cdi\u201d \u0432 npm. \u041f\u0430\u043a\u0435\u0442\u043e\u0432 \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 ~<a href=\"https:\/\/www.npmjs.com\/search?q=di\" rel=\"nofollow\">1400<\/a>. \u0412\u0441\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 npm dependents.<\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<td>repo<\/td>\n<td>npm dependents<\/td>\n<td>npm weekly downloads<\/td>\n<td>github stars<\/td>\n<td>\u0432\u043e\u0437\u0440\u0430\u0441\u0442, \u043b\u0435\u0442<\/td>\n<td>\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043f\u0440\u0430\u0432\u043a\u0430, \u043c\u0435\u0441 \u043d\u0430\u0437\u0430\u0434<\/td>\n<td>lang<\/td>\n<td>ES classes<\/td>\n<td>interfaces<\/td>\n<td>inject property<\/td>\n<td>bundle size, KB<\/td>\n<td>open github issues<\/td>\n<td>github forks<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/inversify\/InversifyJS\" rel=\"nofollow\">inversify\/Inversifyjs<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/inversify?activeTab=dependents\" rel=\"nofollow\">1798<\/a>   <\/td>\n<td>408k<\/td>\n<td>6.6k<\/td>\n<td>6<\/td>\n<td>1<\/td>\n<td>TS<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>63.3<\/td>\n<td>204<\/td>\n<td>458<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/typestack\/typedi\" rel=\"nofollow\">typestack\/typedi<\/a><\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/typedi?activeTab=dependents\" rel=\"nofollow\">353<\/a><\/td>\n<td>62k<\/td>\n<td>1.9k<\/td>\n<td>5<\/td>\n<td>3<\/td>\n<td>TS<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>30.3<\/td>\n<td>17<\/td>\n<td>98<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/thlorenz\/proxyquire\" rel=\"nofollow\">thlorenz\/proxyquire<\/a><\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/proxyquire?activeTab=dependents\" rel=\"nofollow\">344<\/a><\/td>\n<td>426k<\/td>\n<td>2.6k<\/td>\n<td>8<\/td>\n<td>8<\/td>\n<td>ES5<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>9<\/td>\n<td>116<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/jeffijoe\/awilix\" rel=\"nofollow\">jeffijoe\/awilix<\/a><\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/awilix?activeTab=dependents\" rel=\"nofollow\">244<\/a><\/td>\n<td>42k<\/td>\n<td>1.7k<\/td>\n<td>5<\/td>\n<td>1<\/td>\n<td>TS<\/td>\n<td>+<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>31.7<\/td>\n<td>2<\/td>\n<td>92<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/aurelia\/dependency-injection\" rel=\"nofollow\">aurelia\/dependency-injection<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/aurelia-dependency-injection?activeTab=dependents\" rel=\"nofollow\">153<\/a>   <\/td>\n<td>13k<\/td>\n<td>156<\/td>\n<td>6<\/td>\n<td>2<\/td>\n<td>TS<\/td>\n<td>+<\/td>\n<td>&#8212;<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>2<\/td>\n<td>68<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/stampit-org\/stampit\" rel=\"nofollow\">stampit-org\/stampit<\/a><\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/stampit?activeTab=dependents\" rel=\"nofollow\">170<\/a>   <\/td>\n<td>22k<\/td>\n<td>3k<\/td>\n<td>8<\/td>\n<td>1<\/td>\n<td>ES5<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>6<\/td>\n<td>107<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/microsoft\/tsyringe\" rel=\"nofollow\">microsoft\/tsyringe<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/tsyringe?activeTab=dependents\" rel=\"nofollow\">149<\/a>   <\/td>\n<td>80k<\/td>\n<td>1.5k<\/td>\n<td>3<\/td>\n<td>1<\/td>\n<td>TS<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>&#8212;<\/td>\n<td>30.4<\/td>\n<td>27<\/td>\n<td>69<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/boblauer\/mock-require\" rel=\"nofollow\">boblauer\/mock-require<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/mock-require?activeTab=dependents\" rel=\"nofollow\">136<\/a><\/td>\n<td>160k<\/td>\n<td>441<\/td>\n<td>6<\/td>\n<td>1<\/td>\n<td>ES5<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>4<\/td>\n<td>29<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/mgechev\/injection-js\" rel=\"nofollow\">mgechev\/injection-js<\/a><\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/injection-js?activeTab=dependents\" rel=\"nofollow\">105<\/a><\/td>\n<td>236k<\/td>\n<td>928<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>TS<\/td>\n<td>+<\/td>\n<td>-?<\/td>\n<td>?<\/td>\n<td>41.7<\/td>\n<td>0<\/td>\n<td>48<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/young-steveo\/bottlejs\" rel=\"nofollow\">young-steveo\/bottlejs<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/bottlejs?activeTab=dependents\" rel=\"nofollow\">101<\/a>   <\/td>\n<td>16k<\/td>\n<td>1.2k<\/td>\n<td>6<\/td>\n<td>1<\/td>\n<td>ES5 + D.TS<\/td>\n<td>-?<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>13.3<\/td>\n<td>2<\/td>\n<td>63<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/jaredhanson\/electrolyte\" rel=\"nofollow\">jaredhanson\/electrolyte<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/electrolyte?activeTab=dependents\" rel=\"nofollow\">33<\/a><\/td>\n<td>1k<\/td>\n<td>569<\/td>\n<td>7<\/td>\n<td>1<\/td>\n<td>ES5<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>?<\/td>\n<td>25<\/td>\n<td>65<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/zhang740\/power-di\" rel=\"nofollow\">zhang740\/power-di<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/power-di?activeTab=dependents\" rel=\"nofollow\">10<\/a>   <\/td>\n<td>0.2k<\/td>\n<td>65<\/td>\n<td>4<\/td>\n<td>1<\/td>\n<td>TS<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>45.0<\/td>\n<td>2<\/td>\n<td>69<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/jpex-js\/vue-inject\" rel=\"nofollow\">jpex-js\/vue-inject<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/vue-inject?activeTab=dependents\" rel=\"nofollow\">9<\/a><\/td>\n<td>0.8k<\/td>\n<td>174<\/td>\n<td>4<\/td>\n<td>12<\/td>\n<td>ES5<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>?<\/td>\n<td>?<\/td>\n<td>3<\/td>\n<td>14<\/td>\n<\/tr>\n<tr>\n<td> <a href=\"https:\/\/github.com\/zazoomauro\/node-dependency-injection\" rel=\"nofollow\">zazoomauro\/node-dependency-injection<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/node-dependency-injection?activeTab=dependencies\" rel=\"nofollow\">5<\/a>   <\/td>\n<td>1k<\/td>\n<td>123<\/td>\n<td>4<\/td>\n<td>2<\/td>\n<td>ES6 + D.TS<\/td>\n<td>+<\/td>\n<td>-?<\/td>\n<td>+<\/td>\n<td>291.0<\/td>\n<td>3<\/td>\n<td>17<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/justmoon\/constitute\" rel=\"nofollow\">justmoon\/constitute<\/a><\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/constitute?activeTab=dependents\" rel=\"nofollow\">4<\/a><\/td>\n<td>8k<\/td>\n<td>132<\/td>\n<td>5<\/td>\n<td>60<\/td>\n<td>ES6<\/td>\n<td>+<\/td>\n<td>-?<\/td>\n<td>&#8212;<\/td>\n<td>56.2<\/td>\n<td>4<\/td>\n<td>6<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/owja\/ioc\" rel=\"nofollow\">owja\/ioc<\/a><\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/@owja\/ioc?activeTab=dependents\" rel=\"nofollow\">1<\/a>   <\/td>\n<td>2k<\/td>\n<td>158<\/td>\n<td>1<\/td>\n<td>3<\/td>\n<td>TS<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>11.3<\/td>\n<td>4<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/github.com\/kraut-dps\/di-box\/\" rel=\"nofollow\">kraut-dps\/di-box<\/a>   <\/td>\n<td><a href=\"https:\/\/www.npmjs.com\/package\/di-box?activeTab=dependents\" rel=\"nofollow\">1<\/a><\/td>\n<td>0k<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>ES6 + D.TS<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>+<\/td>\n<td>11.1<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p><a href=\"https:\/\/www.githubcompare.com\/inversify\/Inversifyjs+typestack\/typedi+thlorenz\/proxyquire+jeffijoe\/awilix+aurelia\/dependency-injection+stampit-org\/stampit+microsoft\/tsyringe+boblauer\/mock-require+mgechev\/injection-js+young-steveo\/bottlejs+jaredhanson\/electrolyte+zhang740\/power-di+jpex-js\/vue-inject+zazoomauro\/node-dependency-injection+justmoon\/constitute+owja\/ioc+kraut-dps\/di-box\" rel=\"nofollow\">Gitcompare \u0441\u0441\u044b\u043b\u043a\u0430<\/a>  <\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/codesandbox.io\/s\/github\/kraut-dps\/di-inject-fn-examples\/\" rel=\"nofollow\">Codesandbox \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430<\/a><\/p>\n<h3><a href=\"https:\/\/github.com\/inversify\/InversifyJS\" rel=\"nofollow\">https:\/\/github.com\/inversify\/InversifyJS<\/a><\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u0430\u043c\u044b\u0439 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u043d\u043e \u0438 \u043c\u043e\u0449\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043d\u0438\u043c \u0434\u0435\u043b\u0430\u043b \u0441\u0430\u043c\u044b\u043c \u043f\u0435\u0440\u0432\u044b\u043c. \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 )).\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043a\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0441\u044f \u0430\u0432\u0442\u043e\u0440\u0430\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041c\u043e\u043d\u0441\u0442\u0440)<\/p>\n<h3><a href=\"https:\/\/github.com\/typestack\/typedi\" rel=\"nofollow\">https:\/\/github.com\/typestack\/typedi<\/a><\/h3>\n<p>  <\/p>\n<p>\u0427\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043c\u043e\u0449\u043d\u0430\u044f, \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0441\u043c\u043e\u0433 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u044f \u043c\u043e\u0433\u0443 \u0432 App \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Date, \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430. \u0411\u044b\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0443\u0442?<\/p>\n<h3><a href=\"https:\/\/github.com\/thlorenz\/proxyquire\" rel=\"nofollow\">https:\/\/github.com\/thlorenz\/proxyquire<\/a><\/h3>\n<p>  <\/p>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u0442\u0430\u043a\u0438\u043c \u043a\u0430\u043a\u043e\u0439 \u043e\u043d \u0435\u0441\u0442\u044c, \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u043e\u0432. \u0412 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432. \u0421\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c DI, \u043d\u043e \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c.<\/p>\n<h3><a href=\"https:\/\/github.com\/jeffijoe\/awilix\" rel=\"nofollow\">https:\/\/github.com\/jeffijoe\/awilix<\/a><\/h3>\n<p>  <\/p>\n<p>\u041d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u201cSymbol(Symbol.toPrimitive)\u201d, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b, \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Proxy, \u0430 \u0443 \u043c\u0435\u043d\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a \u043e\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e Date \u043a\u043b\u0430\u0441\u0441\u0430. \u041d\u0435 \u0443\u0432\u0438\u0434\u0435\u043b \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432.<\/p>\n<h3><a href=\"https:\/\/github.com\/aurelia\/dependency-injection\" rel=\"nofollow\">https:\/\/github.com\/aurelia\/dependency-injection<\/a><\/h3>\n<p>  <\/p>\n<p>\u0421\u0443\u0434\u044f \u043f\u043e <a href=\"https:\/\/aurelia.io\/docs\/fundamentals\/dependency-injection#injection\" rel=\"nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c<\/a> \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u0446\u0435\u043b\u044c\u044e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043b\u043a\u0438\u0435. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Aurelia.<\/p>\n<h3><a href=\"https:\/\/github.com\/stampit-org\/stampit\" rel=\"nofollow\">https:\/\/github.com\/stampit-org\/stampit<\/a><\/h3>\n<p>  <\/p>\n<p>\u041d\u0435\u043e\u0431\u044b\u0447\u043d\u0430\u044f \u041e\u041e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f. \u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435. \u041d\u0435 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<h3><a href=\"https:\/\/github.com\/microsoft\/tsyringe\" rel=\"nofollow\">https:\/\/github.com\/microsoft\/tsyringe<\/a><\/h3>\n<p>  <\/p>\n<p>\u042f \u043d\u0435 \u0444\u0430\u043d\u0430\u0442 Microsoft, \u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432 \u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445. \u0412\u0441\u0435 \u0443\u043c\u0435\u0435\u0442, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u0447\u0442\u043e \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430.<\/p>\n<h3><a href=\"https:\/\/github.com\/boblauer\/mock-require\" rel=\"nofollow\">https:\/\/github.com\/boblauer\/mock-require<\/a><\/h3>\n<p>  <\/p>\n<p>\u041f\u043e \u0437\u0430\u0434\u0443\u043c\u043a\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/thlorenz\/proxyquire\" rel=\"nofollow\">proxyquire<\/a>.  <\/p>\n<h3><a href=\"https:\/\/github.com\/mgechev\/injection-js\" rel=\"nofollow\">https:\/\/github.com\/mgechev\/injection-js<\/a><\/h3>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0432 Angular 4. \u041e\u0431\u0448\u0438\u0440\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043c\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a \u0432 useFactory \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442.<\/p>\n<h3><a href=\"https:\/\/github.com\/young-steveo\/bottlejs\" rel=\"nofollow\">https:\/\/github.com\/young-steveo\/bottlejs<\/a><\/h3>\n<p>  <\/p>\n<p>\u041c\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0412\u0440\u043e\u0434\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043c\u0435\u0442\u043e\u0434 .instanceFactory, \u043d\u043e \u043a\u0430\u043a \u0442\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e.<\/p>\n<h3><a href=\"https:\/\/github.com\/jaredhanson\/electrolyte\" rel=\"nofollow\">https:\/\/github.com\/jaredhanson\/electrolyte<\/a><\/h3>\n<p>  <\/p>\n<p>\u041d\u0435 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0441 ES6 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0430\u0432\u0442\u043e\u0440\u043e\u043c.<\/p>\n<h3><a href=\"https:\/\/github.com\/zhang740\/power-di\" rel=\"nofollow\">https:\/\/github.com\/zhang740\/power-di<\/a><\/h3>\n<p>  <\/p>\n<p>\u041c\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u0415\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 React. \u0427\u0440\u0435\u0437\u0432\u044b\u0447\u0430\u0439\u043d\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f. \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u043f\u0430\u043a\u0435\u0442\u0430. \u041d\u0435 \u0431\u0435\u0437 \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439, \u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0441\u0432\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<h3><a href=\"https:\/\/github.com\/jpex-js\/vue-inject\" rel=\"nofollow\">https:\/\/github.com\/jpex-js\/vue-inject<\/a><\/h3>\n<p>  <\/p>\n<p>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f vue \u0431\u0435\u0437 ES6 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b. \u0412 \u044d\u0442\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0435\u0441\u0442\u044c \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u043f\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/vuejs\/vue-class-component\" rel=\"nofollow\">ES6 classes<\/a>, \u0438 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b <a href=\"https:\/\/v3.vuejs.org\/guide\/component-provide-inject.html\" rel=\"nofollow\">provide inject<\/a> \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c DI. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439.<\/p>\n<h3><a href=\"https:\/\/github.com\/zazoomauro\/node-dependency-injection\" rel=\"nofollow\">https:\/\/github.com\/zazoomauro\/node-dependency-injection<\/a><\/h3>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c YAML\/JS\/JSON \u0444\u0430\u0439\u043b\u043e\u043c. \u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043d\u0430 php <a href=\"http:\/\/symfony.com\/\" rel=\"nofollow\">symfony<\/a> \u041c\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0434\u0443\u043c\u0430\u043b \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0441\u0442\u044b\u043b\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 setParameter, \u043d\u043e \u0438 \u0442\u0430\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435, \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440.<\/p>\n<h3><a href=\"https:\/\/github.com\/justmoon\/constitute\" rel=\"nofollow\">https:\/\/github.com\/justmoon\/constitute<\/a><\/h3>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b, \u043d\u043e \u043a\u043e\u0441\u0442\u044b\u043b\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043d\u043d\u0443\u043b\u0438\u0440\u0443\u044e\u0442 \u0432\u0441\u0435 DI \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430.<\/p>\n<h3><a href=\"https:\/\/github.com\/owja\/ioc\" rel=\"nofollow\">https:\/\/github.com\/owja\/ioc<\/a><\/h3>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 inversify, \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0439. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u0430\u0432\u0442\u043e\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c: \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u0443\u0436\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043d\u0430\u0434\u043e \u0438\u043c\u0435\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u044d\u0442\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u041f\u043e \u043c\u043e\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e \u0441 \u0442\u0430\u043a\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h3><a href=\"https:\/\/github.com\/kraut-dps\/di-box\" rel=\"nofollow\">https:\/\/github.com\/kraut-dps\/di-box<\/a><\/h3>\n<p>  <\/p>\n<p>\u041c\u043e\u0439 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0438\u0436\u0435.<\/p>\n<p>\u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e \u0447\u0442\u043e \u043c\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0437\u0430\u043c\u043e\u0440\u043e\u0447\u0435\u043d\u043d\u044b\u0439, \u0438 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0431\u0435\u0437 \u0442\u0430\u043a\u0438\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u043d\u043e \u0435\u0441\u043b\u0438 DI \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u043b\u044e\u0441 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u0432\u0435\u0434\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442\u0441\u044f. <\/p>\n<h2>\u0421\u0432\u043e\u0439 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434<\/h2>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043d\u043e\u0439 \u201c\u043c\u0430\u0433\u0438\u0438\u201d, \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0432\u0441\u0435\u043c \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445 \u043b\u0438\u0431\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a:<\/p>\n<pre><code class=\"javascript\">class Service {     work () {         console.log('work');     } }  class App {     oneService;     main () {         this.oneService().work();     } }  \/\/ \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 es6 \u043a\u043b\u0430\u0441\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 DI class AppBox {     Service;     App;      _oService;      newApp () {         const oApp = new this.App();          \/\/ \u0442\u0443\u0442 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043d\u0430\u044f \u043c\u0430\u0433\u0438\u044f         oApp.oneService = this.oneService.bind(this);          return oApp;     }      oneService () {         if (!this._oService) {             this._oService = new this.Service();         }         return this._oService;     } }  const oBox = new AppBox(); oBox.Service = Service; oBox.App = App; const oApp = oBox.newApp(); oApp.main(); <\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 Box \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0438 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u044b, .<\/p>\n<p>\u041d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u044b (.one()), \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c bind(this), \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u0421 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u044d\u0442\u043e\u0442 \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">import {Box} from &quot;di-box&quot;;  class Service {     work() {         console.log( 'work' );     } }  class App {     oneService;     main() {         this.oneService().work();     } }  class AppBox extends Box {     App;     Service;      newService() {         return new this.Service();     }      oneService() {         return this.one( this.newService );     }      newApp() {         const oApp = new this.App();         oApp.oneService = this.oneService;         return oApp;     } }  const oBox = new AppBox(); oBox.Service = Service; oBox.App = App; const oApp = oBox.newApp(); oApp.main(); <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432 <a href=\"https:\/\/codesandbox.io\/s\/github\/kraut-dps\/di-box\/tree\/0.2.2\/examples\/?file=\/example-js.js\" rel=\"nofollow\">codesandbox<\/a><\/p>\n<p>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0442\u0430\u043a\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const oBox = new AppBox(); \/\/ \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e oBox.Service = Service; oBox.App = App; const oApp = oBox.newApp(); \/\/ \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430: \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Service is undefined oApp.main(); <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b&#8230;<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f DI \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0447\u0430\u0441\u0442\u0435\u043d\u044c\u043a\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440. \u0418 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0435 \u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043c\u044b\u0441\u043b\u044c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u0443\u0434\u043e\u0431\u043d\u0435\u0435. \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043f\u043e \u043a\u043b\u044e\u0447\u0443, \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0447\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u043e\u043c\u0443 \u043d\u043e\u043c\u0435\u0440\u0443.<\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435:<\/p>\n<pre><code class=\"javascript\">constructor( arg1, arg2, arg3 ) {}  \/\/ \u0438  constructor( { arg1key: arg1, arg2key: arg2, arg3key: arg3 } ) {} <\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u0435\u0449\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432, \u043d\u0435 \u0432\u043e \u0432\u0440\u0435\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430?<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/li>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u0432 ES \u0442\u0430\u043a\u0438 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0432 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0435 \u0438\u0437-\u0437\u0430 <a href=\"https:\/\/stackoverflow.com\/questions\/43595943\/why-are-derived-class-property-values-not-seen-in-the-base-class-constructor\/43595944\" rel=\"nofollow\">\u044d\u0442\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/a>. \u0410 DI \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u0443\u043c\u0430\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u043c.<\/p>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u043d\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0441\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c undefined. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u0441 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432. \u041a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0432\u0441\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435:<\/p>\n<pre><code class=\"javascript\">class A {     _arg1;     _arg2;      constructor( arg1, arg2 = null ) {         this._arg1 = arg1;         this._arg2 = arg2;     } } const instance = new A( 1, 2 );  \/\/ \u0438  class A {     arg1; \/\/ \u0431\u0443\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e     arg2 = null; \/\/ \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 null !== undefined } const instance = new A(); instance.arg1 = 1; instance.arg2 = 2; <\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432 dependency injection \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c. \u042d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 <a href=\"https:\/\/github.com\/kraut-dps\/di-box\" rel=\"nofollow\">di-box<\/a>.<\/p>\n<p>\u041d\u043e \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0438\u043b\u0438 \u0434\u043b\u044f typescript \u0441 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u043e\u043c \u0442\u0438\u043f\u0430 constructor( public arg1: type, public arg2: type ) \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u043e\u043f\u0446\u0438\u044f\u043c\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 Box:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">new AppBox( { bNeedSelfCheck: false, sNeedCheckPrefix: null } ); <\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430 <a href=\"https:\/\/codesandbox.io\/s\/github\/kraut-dps\/di-box\/tree\/0.2.2\/examples\/?file=\/example-ts.ts\" rel=\"nofollow\">codesandbox<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u043e\u0433\u043e \u0441 di-box \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u041e\u041e\u041f \u0441\u0442\u0438\u043b\u0435, \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c, \u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u043c DI. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043d\u0430\u044f \u201c\u043c\u0430\u0433\u0438\u044f\u201d, \u043d\u043e \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043c\u0435\u0442\u0430 \u0443\u0440\u043e\u0432\u043d\u0435, \u0438 \u0441\u0430\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0447\u0438\u0441\u0442\u044b\u043c\u0438, \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0442\u044c \u043e\u0431 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0443\u0441\u0442\u0438\u043b \u0438\u0437 \u0432\u0438\u0434\u0443 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0418\u043b\u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u0437 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 DI. \u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<\/div>\n<p> \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\/post\/528890\/\"> https:\/\/habr.com\/ru\/post\/528890\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r1\/oy\/vk\/r1oyvktsseijavhy4gyhjqb1zja.jpeg\"><\/p>\n<p>\u0418\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439, \u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 DI npm \u043f\u0430\u043a\u0435\u0442\u0430\u0445. \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u0432\u043e\u0439 DI.<\/p>\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-313436","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313436","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=313436"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313436\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}