{"id":155029,"date":"2012-10-17T04:49:37","date_gmt":"2012-10-17T00:49:37","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=155029"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=155029","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 TypeScript<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e Microsoft \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430 <a href=\"http:\/\/habrahabr.ru\/post\/153077\/\">\u043d\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f TypeScript<\/a>. \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043c\u043d\u043e\u0433\u0438\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u0434\u043b\u044f Microsoft Visual Studio \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u044f\u0437\u044b\u043a \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u041a\u0430\u0436\u0434\u044b\u0439 \u0441 \u044d\u0442\u0438\u043c \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f<\/h4>\n<p>  \u041b\u044e\u0431\u043e\u0439, \u043a\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 HTML+js, \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439: \u043a\u0430\u043a \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 (<a href=\"http:\/\/api.jquery.com\/jQuery\/#jQuery-html-props\">\u0440\u0430\u0437<\/a>, <a href=\"https:\/\/github.com\/jquery\/jquery-tmpl\">\u0434\u0432\u0430<\/a>, <a href=\"http:\/\/knockoutjs.com\/\">\u0442\u0440\u0438<\/a>, <a href=\"http:\/\/backbonejs.org\/\">\u0447\u0435\u0442\u044b\u0440\u0435<\/a> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435), \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0438, \u0432\u0440\u043e\u0434\u0435 \u0442\u0430\u043a\u0438\u0445:<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code class=\"javascript\">var StringTemplate =         &quot;&lt;div class=\\&quot;{Flag}\\&quot; &gt;&quot; +             &quot;&lt;p class=\\&quot;name\\&quot; &gt;{Name}&lt;\/p&gt;&quot; +             &quot;&lt;p class=\\&quot;message\\&quot; &gt;{Text}&lt;\/p&gt;&quot; +             &quot;&lt;p class=\\&quot;date\\&quot; &gt;{Date}&lt;\/p&gt;&quot; +         &quot;&lt;\/div&gt;&quot;,     html = &quot;&quot;,     Container = document.getElementById('container2');      for (var i = 0; i &lt; TestDataLength; i++) {                  html += StringTemplate                 .replace(\/\\{Flag\\}\/g, TestData[i].Out ? &quot;message out&quot; : &quot;message&quot;)                 .replace(\/\\{Name\\}\/g, TestData[i].Name || &quot;&quot;)                 .replace(\/\\{Text\\}\/g, TestData[i].Text || &quot;&quot;)                 .replace(\/\\{Date\\}\/g, TestData[i].Date.toLocaleTimeString());              }     Container.innerHTML = html; <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043e\u0434\u043d\u0430\u043a\u043e, \u043e\u043d \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c id \u0438\u043b\u0438 data-id \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e jQuery \u0438\u043b\u0438 querySelector \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043d\u043e \u043f\u043e\u0438\u0441\u043a \u043f\u043e DOM \u0432\u0435\u0441\u044c\u043c\u0430 \u2014 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0435\u043c\u043a\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441.<\/p>\n<h4>\u0417\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u2014 \u043b\u044e\u0431\u0438\u043c\u044b\u0435 \u0434\u0440\u0443\u0437\u044c\u044f js-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430!<\/h4>\n<p>  \u0421\u0430\u043c\u044b\u0439 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0447\u0430\u0441\u0442\u043e\u0439 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0443\u0447\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 DOM. \u041c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0430\u0436 \u0446\u0435\u043b\u044b\u0445 \u0442\u0440\u0438: document.createElement(), document.createTextNode() \u0438 (\u043d\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e) document.createAttr(). \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <a href=\"http:\/\/jsperf.com\/innerhtml-vs-createelement-test\/7\">\u0434\u0430\u0436\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435<\/a>, \u0447\u0435\u043c \u0441 innerHTML, \u043d\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 \u043a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0435 \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438.<\/p>\n<h5>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0430\u0445\u0430\u0440\u0430<\/h5>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c Templater \u0438 \u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0441\u0434\u0435\u043b\u0430\u044e\u0442 \u043a\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"javascript\">module Templater {      export function Element(TagName: string, Attributes: Object) : HTMLElement {         var item:HTMLElement = document.createElement(TagName);          for (var p in Attributes)             if (typeof(Attributes[p]) == &quot;string&quot;)                 item.setAttribute(p, Attributes[p]);             else if (Attributes[p] instanceof Attr)                 item.setAttributeNode(Attributes[p]);          return item;     }      export function Text(Text: string): Text {         return document.createTextNode(Text);     }      export function Nest(Element: HTMLElement, Items: any[]): HTMLElement {         var l = Items.length;         for (var i = 0; i &lt; l; i++)             if (Items[i])                 Element.appendChild(Items[i]);         return Element;     }     \/\/ ... <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0442\u0435\u0433 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0438 \u0437\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, Nest \u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 Text \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0438\u043d\u043e\u043d\u0438\u043c \u0434\u043b\u044f document.createTextNode();<\/p>\n<h5>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h5>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 TypeScript \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0431\u043b\u0430\u0433\u043e \u0446\u0438\u0432\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u043d\u0435\u043d\u0430\u0432\u044f\u0437\u0447\u0438\u0432\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f, \u0442\u043e \u0435\u0439 \u0441\u0442\u043e\u0438\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043f\u043e\u0441\u0442\u0443\u043f\u043e\u043a:  <\/p>\n<pre><code class=\"javascript\">    export class Block {         constructor (public Element: HTMLElement, public Binding) {         }     } <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c:  <\/p>\n<pre><code class=\"javascript\">       export class Template {          constructor (public Create: {                                 (Element: { (TagName: string, Attributes: Object): HTMLElement; },                                     Nest: { (Element: HTMLElement, Items: any[]): HTMLElement; },                                     Text: { (Text: string): Text; }) : Block; },                      public Update: { (Element: Block, Data); }) {         }          public Make(Data) {             var item = this.Create(Element, Nest, Text);             this.Update(item, Data);             return item;         }     } <\/code><\/pre>\n<p>  \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043c\u0435\u0442\u0438\u0442, \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e: \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0431\u0443\u0434\u0443\u0442 \u0437\u043d\u0430\u0442\u044c, \u0447\u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0442 \u043d\u0435\u0433\u043e \u0445\u043e\u0447\u0435\u0442.<\/p>\n<h5>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h5>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"javascript\">import T = Templater;  var myItem = new T.Template(     (Element, Nest, Text) =&gt; {         var Name, Date, Text, Flag, Container;          Nest(Container = Element('div',                  { 'class': Flag = document.createAttribute(&quot;class&quot;) } ), [             Name = Element('p', { 'class': 'name' }),             Text = Element('p', { 'class': 'text' }),             Date = Element('p', { 'class': 'date' })         ]);          return new T.Block(Container, {             Name: Name,             Date: Date,             Text: Text,             Flag: Flag,             Container: Container         });     },     (Element: T.Block, Data) =&gt; {         var b = Element.Binding;         b.Name.innerText = Data.Name || &quot;&quot;;         b.Date.innerText = Data.Date.toLocaleTimeString();         b.Text.innerText = Data.Text || &quot;&quot;;         b.Flag.nodeValue = &quot;message &quot; + (Data.Out == true ? &quot;out&quot; : &quot;&quot;);     }); <\/code><\/pre>\n<p>  \u041f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e TypeScript \u2014 \u0443\u043a\u043e\u0440\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 ( \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b ) =&gt; { \u043a\u043e\u0434 }. \u041e\u043d\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u043a \u0447\u0442\u0435\u043d\u0438\u044e.<br \/>  \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b (Element, Nest, Text) \u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438: \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043f\u0440\u044f\u043c\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u044f. \u0422\u0430\u043a\u043e\u0432\u044b \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 Javascript \u0438 Typescript \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d.<br \/>  \u0427\u0442\u043e \u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434?<br \/>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Create) \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0430\u0440\u0443 (\u044d\u043b\u0435\u043c\u0435\u043d\u0442, binding), \u0433\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u043a\u043e\u0435 \u043f\u043e\u0434\u043e\u0431\u0438\u0435 ViewBag, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. QuerySelector \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<br \/>  \u0412\u0442\u043e\u0440\u0430\u044f \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f (Update) \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Data \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 Binding<\/p>\n<h4>\u041d\u0430\u0431\u043e\u0440 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>  \u041a\u043e\u0434, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u0430\u043a \u0432 \u0441\u0442\u0430\u0440\u043e\u043c-\u0434\u043e\u0431\u0440\u043e\u043c .NET<\/p>\n<pre><code class=\"javascript\">module Example {     export class ExampleData {          constructor (public Name: string,                     public Date: Date,                     public Text: string,                     public Out: bool) {         }          public static GetExampleData(count: number): any[] {             var result = [],                 ExampleText = &quot;Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...&quot;,                 NameA = &quot;John Doe&quot;, NameB = &quot;Jane Doe&quot;,                 StartDate = new Date(),                 Interval = 300;              for (var i = 0; i &lt; count; i++) {                 result.push(new ExampleData(                     i % 2 == 1 ? NameA : NameB,                     StartDate,                     ExampleText,                     i % 2 == 1));                 StartDate = new Date(StartDate.getTime() + Interval);             }              return result;         }     } } <\/code><\/pre>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u044f \u0441 TypeScript \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0448\u044c \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e this \u0432 \u044d\u0442\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0442\u043e \u0436\u0435, \u0447\u0442\u043e \u0438 C-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u043d\u0435 \u00ab\u0447\u0442\u043e-\u0442\u043e-\u0442\u0430\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00bb.<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c<\/h4>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"javascript\">window.onload = () =&gt; {      var TestDataLength = 1500,         TestData = Example.ExampleData.GetExampleData(TestDataLength),         Container = document.getElementById('container1');      var TestStart = new Date();     for (var i = 0; i &lt; TestDataLength; i++)         Container.appendChild(myItem.Make(TestData[i]).Element);     var TestEnd = new Date();      console.log(&quot;Test completed&quot;, {         time: TestEnd.getTime() - TestStart.getTime(),         count: TestDataLength     });      var StringTemplate =         &quot;&lt;div class=\\&quot;{Flag}\\&quot; &gt;&quot; +             &quot;&lt;p class=\\&quot;name\\&quot; &gt;{Name}&lt;\/p&gt;&quot; +             &quot;&lt;p class=\\&quot;message\\&quot; &gt;{Text}&lt;\/p&gt;&quot; +             &quot;&lt;p class=\\&quot;date\\&quot; &gt;{Date}&lt;\/p&gt;&quot; +         &quot;&lt;\/div&gt;&quot;;     var html = &quot;&quot;;     Container = document.getElementById('container2');      TestStart = new Date();     for (var i = 0; i &lt; TestDataLength; i++) {                  html += StringTemplate                 .replace(\/\\{Flag\\}\/g, TestData[i].Out ? &quot;message out&quot; : &quot;message&quot;)                 .replace(\/\\{Name\\}\/g, TestData[i].Name || &quot;&quot;)                 .replace(\/\\{Text\\}\/g, TestData[i].Text || &quot;&quot;)                 .replace(\/\\{Date\\}\/g, TestData[i].Date.toLocaleTimeString());              }     Container.innerHTML = html;     TestEnd = new Date();     console.log(&quot;Test with string templater completed&quot;, {         time: TestEnd.getTime() - TestStart.getTime(),         count: TestDataLength     }); }; <\/code><\/pre>\n<p>  \u0418 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<br \/>  <code>tsc templater.ts<\/code><br \/>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0432, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u0435\u0442 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 js \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, Microsoft!<\/p>\n<p>  <a href=\"https:\/\/dl.dropbox.com\/u\/22264454\/coding\/Templater.7z\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>    \t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/155029\/\"> http:\/\/habrahabr.ru\/post\/155029\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e Microsoft \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430 <a href=\"http:\/\/habrahabr.ru\/post\/153077\/\">\u043d\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f TypeScript<\/a>. \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043c\u043d\u043e\u0433\u0438\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u0434\u043b\u044f Microsoft Visual Studio \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u044f\u0437\u044b\u043a \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u041a\u0430\u0436\u0434\u044b\u0439 \u0441 \u044d\u0442\u0438\u043c \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f<\/h4>\n<p>  \u041b\u044e\u0431\u043e\u0439, \u043a\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 HTML+js, \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439: \u043a\u0430\u043a \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 (<a href=\"http:\/\/api.jquery.com\/jQuery\/#jQuery-html-props\">\u0440\u0430\u0437<\/a>, <a href=\"https:\/\/github.com\/jquery\/jquery-tmpl\">\u0434\u0432\u0430<\/a>, <a href=\"http:\/\/knockoutjs.com\/\">\u0442\u0440\u0438<\/a>, <a href=\"http:\/\/backbonejs.org\/\">\u0447\u0435\u0442\u044b\u0440\u0435<\/a> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435), \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0438, \u0432\u0440\u043e\u0434\u0435 \u0442\u0430\u043a\u0438\u0445:  <\/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-155029","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155029","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=155029"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/155029\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=155029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=155029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=155029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}