{"id":305635,"date":"2020-06-19T15:01:31","date_gmt":"2020-06-19T15:01:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305635"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305635","title":{"rendered":"\u0414\u0435\u043b\u0430\u0435\u043c \u0438\u0433\u0440\u0443 \u0421\u043b\u043e\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u0438 title \u0441\u0430\u0439\u0442\u0430"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/507360\/\">\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0433\u0440\u0443 \u00ab\u0421\u043b\u043e\u0442\u044b\u00bb \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0430\u0439\u0442\u0430(\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/titlerun.xyz\" rel=\"nofollow\">TitleRun<\/a>). \u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u0438\u0433\u0440\u044b \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0448\u044c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0441\u043b\u043e\u0442\u044b, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0441\u043b\u043e\u0442\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u2014 \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0448\u044c. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dz\/g7\/2j\/dzg72j6j5xgb-tuk_lvyqvdb0rk.png\" alt=\"image\"><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0417\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0433\u0440\u044b \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438 \u0441\u0430\u0439\u0442\u0430?<\/h3>\n<p>  \u0414\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u0438 \u0437\u0432\u0443\u0447\u0438\u0442 \u043a\u0430\u043a \u043d\u0435\u0447\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0435, \u043d\u043e, \u0432\u0441\u0451 \u0436\u0435, \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u0412\u043e \u0432\u0441\u044f\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u0447\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<h3>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/h3>\n<p>  \u0410\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">setInterval<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">function animation() {     let i = 0;     setInterval(() =&gt; {         document.title = `\u0422\u0430\u0439\u043c\u0435\u0440 - ${i}`;         i++;     }); } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">setTimeout<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">let timer = 0; function animation() {     document.title = `\u0422\u0430\u0439\u043c\u0435\u0440 - ${timer}`;     timer++;     setTimeout(animation, 1000) } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">while \u0438 await<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0431\u044b\u043b \u0432 <br \/>  <a href=\"https:\/\/github.com\/janniks\/TitleRun\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 TitleRun`a<\/a><\/p>\n<pre><code class=\"javascript\">function sleep(ms) {     return new Promise((r) =&gt; setTimeout(r, ms)); } async function animation() {     let i = 0;     while(true) {         document.title = `\u0422\u0430\u0439\u043c\u0435\u0440 - ${i}`;         await sleep(1000);     } } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<h3>\u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430<\/h3>\n<p>  \u041a\u0430\u043a \u0441\u043b\u043e\u0442\u044b \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043c\u043e\u0434\u0437\u0438(\u0441\u043c\u0430\u0439\u043b\u0438\u043a\u0438, emoji, \u043a\u0430\u043a \u0432\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u0435\u0435):<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kr\/en\/6a\/kren6adfrkw7en4cim338swzvl8.png\" alt=\"image\"><\/p>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a \u044f \u0441\u043c\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0441\u043b\u043e\u0442\u044b:<\/p>\n<pre><code class=\"javascript\">const getSlot = () =&gt; {     const slot = Math.ceil(Math.random()*slots.length-1);     return slots[slot]; }; const getSlots = () =&gt; {     return slots.map(getSlot); }; <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443, \u0431\u0443\u0434\u0435\u0442 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u0442\u043e\u0432, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f: <\/p>\n<pre><code class=\"javascript\">const spin = document.getElementById('spin'); const slotsAnimation = async () =&gt; {     let speed = 20;     while (true) {         \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u044e \u0441\u043b\u043e\u0442\u044b         const slotsRandom = getSlots();         \/\/\u0432\u044b\u0432\u043e\u0436\u0443         document.title = slotsRandom.join('');         if(speed &gt;= 1000) {             checkWin(slotsRandom);             break;         }         speed += 50;         await sleep(speed);     } }; spin.addEventListener('click', StartGame); <\/code><\/pre>\n<p>  checkWin \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430:<\/p>\n<pre><code class=\"javascript\">const checkWin = (slots) =&gt; {     for(let i=0;i&lt;slots.length-1;i++) {         \/\/\u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0442 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0451\u0442 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c         if(slots[i] !== slots[i+1]) {             alert('GAME OVER');             return;         }     }     alert('WIN!!'); }; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0443\u0436\u0435 \u0438\u0433\u0440\u0430\u0431\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u041d\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439(\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430 \u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044e)<br \/>  \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u0432\u0435\u0441\u0442\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0442\u0438\u043f\u0430:<\/p>\n<pre><code class=\"javascript\">let playing = false; let win = false; <\/code><\/pre>\n<p>  \u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"javascript\">const slotsAnimation = async () =&gt; {     playing = true     let speed = 20;     while (playing) {         const slotsRandom = getSlots();         document.title = slotsRandom.join('');         if(speed &gt;= 1000) {             checkWin(slotsRandom);             playing = false         }         speed += 50;         await sleep(speed);     } }; const winAnimation = async () =&gt; {     win = true;     while(win &amp;&amp; !playing) {         document.title = 'WIN!*';         await sleep(1000);         document.title = '*WIN!';         await sleep(1000);     } }; \/\/\u042d\u0442\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0446\u0438\u043a\u043b\u0438\u0447\u043d\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0442\u044b const mainAnimation = async () =&gt; {     playing = false     let i = 0;     while (!playing &amp;&amp; !win) {         if(i === slots.length - 1) i = 0;         else i++;         document.title = slots[i].repeat(slots.length);         await sleep(1000);     } }; <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0414\u0435\u043b\u0430\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u0435\u0435<\/h3>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043c\u0435\u043d\u0438\u0442 \u043b\u043e\u0433\u0438\u043a\u0443 winAnimation. \u041e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u0432, \u043a\u043e\u043b-\u0432\u043e\u043c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0438 \u043a\u043e\u043b\u0431\u0435\u043a\u043e\u043c.<\/p>\n<pre><code class=\"javascript\">const message = async ({text = [], count = 'infinity', speed = 1000, callback = null}) =&gt;  {     if(!text[0]) throw new Error('need array for text');     let i = 0;     let textIndex = 0;     while(true) {         if(count &lt;= i &amp;&amp; count !== 'infinity') {             \/\/ \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043a\u043e\u043b\u0431\u0435\u043a, \u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0441\u0442\u044c             if(callback) callback();             break;         }         if(textIndex &gt;= text.length) textIndex = 0;         \/\/\u0417\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0446\u0438\u043a\u043b\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c 1 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439         document.title = text[textIndex];         i++;         textIndex++;         await sleep(speed)     } }; \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 message({text: ['\ufe0fWINNER', 'WINNER\ufe0f'], count: 3, speed: 800, callback: mainAnimation}) <\/code><\/pre>\n<p>  \u0415\u0449\u0451 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 \u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438.  <\/p>\n<pre><code class=\"javascript\">class Animations {     animations = [];     setAnimation(animation, args = {}) {         \/\/ \u0412\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438         for(const item of this.animations) {             item.play = false         }         \/\/ \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e         const Animation = this.animations.find(item =&gt; item.name === animation);         if(!Animation) return;         Animation.play = true;         Animation.callback(args)     };     isPlay(animation) {         return this.animations.find(item =&gt; item.name === animation).play     }     createAnimation(name, callback) {         this.animations.push({             play: false,             name,             callback,         })     } } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<br \/>  setAnimation \u2014 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e.<br \/>  isPlay \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u00ab\u0438\u0433\u0440\u0430\u0435\u0442\u00bb \u043b\u0438 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f.<br \/>  createAnimation \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">const checkWin = (slots) =&gt; {     for(let i=0;i&lt;slots.length-1;i++) {         if(slots[i] !== slots[i+1]) {             alert('GAME OVER');             animations.setAnimation('main');             return;         }     }     alert('WIN!!');     animations.setAnimation('message',         {text: ['\ufe0fWINNER', 'WINNER\ufe0f'], count: 3, speed: 800, callback: () =&gt; animations.setAnimation('main')}) }; const slotsAnimation = async () =&gt; {     let speed = 20;     while (animations.isPlay('game')) {         const slotsRandom = getSlots();         document.title = slotsRandom.join('');         if(speed &gt;= 1000) {             checkWin(slotsRandom);         }         speed += 50;         await sleep(speed);     } }; const mainAnimation = async () =&gt; {     let i = 0;     while (animations.isPlay('main')) {         if(i === slots.length - 1) i = 0;         else i++;         document.title = slots[i].repeat(slots.length);         await sleep(1000);     } }; \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439 animations.createAnimation('main', mainAnimation); animations.createAnimation('game', slotsAnimation); animations.createAnimation('message', message); \/\/ \u0417\u0430\u043f\u0443\u0441\u043a animations.setAnimation('main'); <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u043e\u0442<\/h3>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0441\u043b\u043e\u0442.<br \/>  (\u0422\u0443\u0442 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0435\u0440\u0451\u043c emoji \u0438\u0437 API, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e)<\/p>\n<pre><code class=\"javascript\">const AddSlot = async () =&gt; {     \/\/ \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u043a\u0430 \u0436\u0434\u0451\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 API     animations.setAnimation('message', {text: ['Getting slot','Getting slot'], speed: 500});     try {         const data = await fetch(`https:\/\/emoji-api.com\/emojis?access_key=\u041a\u041b\u042e\u0427`);         const body = await data.json();         const emoji = await body[Math.floor(Math.random() * body.length -1)];         slots.push(emoji.character);     } catch (e) {         \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c         console.log(e);         animations.setAnimation('none');         document.title = 'Error, try again';         await sleep(800);     } finally {         animations.setAnimation('main');     } }; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0451. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u043e\u0432\u043e\u0435.<\/p>\n<p>  \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 GitHub \u2014 <a href=\"https:\/\/github.com\/sagadav\/TitleSlots\" rel=\"nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a>.<br \/>  \u0421\u0430\u0439\u0442-\u043f\u0440\u0438\u043c\u0435\u0440 \u2014 <a href=\"https:\/\/titleslots.vercel.app\" rel=\"nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a>.<\/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\/507360\/\"> https:\/\/habr.com\/ru\/post\/507360\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/507360\/\">\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0433\u0440\u0443 \u00ab\u0421\u043b\u043e\u0442\u044b\u00bb \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0430\u0439\u0442\u0430(\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/titlerun.xyz\" rel=\"nofollow\">TitleRun<\/a>). \u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430 \u0438\u0433\u0440\u044b \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0448\u044c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0441\u043b\u043e\u0442\u044b, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0441\u043b\u043e\u0442\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u2014 \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0448\u044c. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dz\/g7\/2j\/dzg72j6j5xgb-tuk_lvyqvdb0rk.png\" alt=\"image\">  <\/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-305635","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305635","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=305635"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305635\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}