{"id":305029,"date":"2020-06-08T21:00:11","date_gmt":"2020-06-08T21:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305029"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305029","title":{"rendered":"Alpine.js \u2013 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445"},"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\/505954\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-0\/bu\/pw\/-0bupwt-1dbdv_9vs-skuvmzdpc.png\" alt=\"\u043e\u0431\u043b\u043e\u0436\u043a\u0430 \u0441\u0442\u0430\u0442\u044c\u0438\"><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/504650\/\">\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437<\/a>, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 to-do \u043d\u0430 Alpine.js, \u043c\u0435\u043d\u044f \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u0442\u0440\u043e\u0438\u043b\u043e, \u0447\u0442\u043e, \u0445\u043e\u0442\u044c \u044f \u0438 \u043c\u043e\u0433\u0443 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u0427\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u0443\u044e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, <code>$parent<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u0438\u0445\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044f\u0438\u0446\u0430 \u0432 \u043e\u0434\u043d\u0443 \u043a\u043e\u0440\u0437\u0438\u043d\u0443. \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0435 \u0437\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043b\u0438\u0441\u044c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438. \u042f \u0445\u043e\u0442\u0435\u043b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <code>todos<\/code> \u043c\u0435\u043d\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0434\u0443\u043c\u0430\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u043e \u0432\u044b \u043d\u0435 \u043f\u0440\u0430\u0432\u044b. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u043e \u0443\u0436\u0430\u0441\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0451, \u0440\u0430\u0441\u0445\u043e\u0434\u0438\u043c\u0441\u044f? \u041d\u0435\u0442. \u042f \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u043b\u0438\u0441\u0430\u043b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043f\u0440\u043e \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <a href=\"https:\/\/github.com\/alpinejs\/alpine\/blob\/master\/README.ru.md#dispatch\" rel=\"nofollow\"><code>$dispatch<\/code><\/a>. \u041d\u0443, \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u2026 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c, \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041d\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c. \u0410 \u043f\u043e\u0442\u043e\u043c \u0435\u0449\u0435 \u043f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0438\u043c \u0432\u0441\u0451 \u0441 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c store.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"probros-sobytiy\">\u041f\u0440\u043e\u0431\u0440\u043e\u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u043a\u0440\u043e\u0435\u043c <a href=\"https:\/\/codesandbox.io\/s\/todo-list-alpine-5mwy9\" rel=\"nofollow\">\u043d\u0430\u0448 \u043a\u043e\u0434<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u2013 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 <code>input<\/code> \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0432 \u043d\u0435\u0433\u043e <code>inputValue<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div x-data=&quot;{ inputValue: '' }&quot; class=&quot;add-todo&quot;&gt;   &lt;input type=&quot;text&quot; x-model=&quot;inputValue&quot; placeholder=&quot;\u041d\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430&quot; \/&gt;   &lt;button @click=&quot;addTodo()&quot;&gt;\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c&lt;\/button&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <code>addTodo()<\/code>. \u0415\u043c\u0443 \u0438 \u043d\u0435 \u043d\u0430\u0434\u043e. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0438\u0442\u044c <a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/Guide\/Events\/%D0%A1%D0%BE%D0%B7%D0%B4%D0%B0%D0%BD%D0%B8%D0%B5_%D0%B8_%D0%B2%D1%8B%D0%B7%D0%BE%D0%B2_%D1%81%D0%BE%D0%B1%D1%8B%D1%82%D0%B8%D0%B9\" rel=\"nofollow\"><code>CustomEvent<\/code><\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;button @click=&quot;$dispatch('add', inputValue)&quot;&gt;\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c&lt;\/button&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0438\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>add<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>inputValue<\/code> \u043a\u0430\u043a payload (\u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>detail<\/code>).<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c. \u041f\u0440\u0438\u043c\u0435\u0442 \u0435\u0433\u043e \u043d\u0430\u0448 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u0418 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 <code>addTodo()<\/code> \u0441 \u043d\u0430\u0448\u0438\u043c <code>inputValue<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div x-data=&quot;todos()&quot; x-init=&quot;fetchTodos()&quot; @add=&quot;addTodo($event.detail)&quot; class=&quot;app&quot;&gt;   ... &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c <code>addTodo()<\/code> \u0438 \u0433\u043e\u0442\u043e\u0432\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">addTodo: function (inputValue) {   if (!inputValue) {     return;   }    this.todos.push({     id: Date.now(),     title: inputValue,     completed: false,   }); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0451 \u043a\u0440\u0443\u0442\u043e, \u0432\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043f\u0435\u0440\u044c <code>inputValue<\/code> \u043d\u0435 \u043e\u0442\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u043c. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;button @click=&quot;$dispatch('add', inputValue); inputValue = ''&quot;&gt;\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c&lt;\/button&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u043c\u043e\u0436\u043d\u043e?.. \u041d\u0435\u0442. <code>$dispatch<\/code> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0435. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0442\u0430\u043a \u0442\u043e\u0436\u0435 \u0442\u0435\u0440\u043f\u0438\u043c\u043e. \u0415\u0441\u043b\u0438 \u0431\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u043e\u0433\u0438\u043a\u0438, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0432\u043c\u0435\u0441\u0442\u043e <code>inputValue = ''<\/code> \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432 <code>&lt;script&gt;<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0423 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 <code>inputValue<\/code> \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u041d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0438 <code>addTodo()<\/code> \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438. \u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e?<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u043e. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u0432 <code>detail<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>inputValue<\/code> \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 to-do \u0438 \u0437\u0430\u043f\u0443\u0448\u044c\u0442\u0435 \u0435\u0433\u043e \u0432 <code>todos<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0437\u043d\u0430\u0435\u0442\u0435 \u0447\u0442\u043e? \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u0430\u043c\u0438. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u044c\u044e \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \ud83d\ude42 \u0418 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0442\u0447\u0438\u0441\u0442\u0438\u0442\u044c <code>inputValue<\/code> \u043f\u043e\u0441\u043b\u0435. <a href=\"https:\/\/codesandbox.io\/s\/todo-list-alpine-2components-b5zqz\" rel=\"nofollow\">\u0412\u043e\u0442 \u043a\u0430\u043a \u044f \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"globalnoe-hranilische-dannyh\">\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p>  <\/p>\n<p>\u0412\u044b, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u0442\u0435\u043c\u0430. \u0412\u0441\u0451, \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u0432\u044b\u0448\u0435, \u2013 \u044d\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043a\u0440\u0443\u0442\u043e. \u041d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0445\u0440\u043e\u043c\u0430\u0435\u0442. \u0418 \u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0442 \u043c\u044b\u0441\u043b\u044c: &quot;\u0411\u044b\u043b\u043e \u0431\u044b \u043a\u0440\u0443\u0442\u043e \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c store, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 Redux\/Mobx\/Vuex \u0438 \u0442.\u043f. \u0418 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0443\u0436\u0435 \u043a \u043d\u0435\u043c\u0443, \u043d\u0435 \u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u0432\u0432\u0435\u0440\u0445 \u0431\u0435\u0437 \u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u0438.&quot;<\/p>\n<p>  <\/p>\n<p>\u0417\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c, <a href=\"https:\/\/github.com\/ryangjchandler\/spruce\" rel=\"nofollow\">Spruce<\/a>. 2 \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442\u0430 \u0447\u0438\u0441\u0442\u043e\u0439 \u0433\u043e\u0434\u043d\u043e\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a <a href=\"https:\/\/codesandbox.io\/s\/todo-list-alpine-5mwy9\" rel=\"nofollow\">\u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443<\/a> \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0441\u0435 \u043f\u043e \u043d\u043e\u0432\u043e\u043c\u0443. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c, \u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u043f\u043e \u0445\u043e\u0434\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;head&gt;   ...   &lt;script src=&quot;https:\/\/cdn.jsdelivr.net\/gh\/ryangjchandler\/spruce@0.6.0\/dist\/spruce.umd.js&quot;&gt;&lt;\/script&gt;   &lt;script src=&quot;https:\/\/cdn.jsdelivr.net\/gh\/alpinejs\/alpine@v2.3.5\/dist\/alpine.min.js&quot;&gt;&lt;\/script&gt; &lt;\/head&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e Alpine.js \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0443 Alpine <code>defer<\/code>. \u0422\u0430\u043a\u0443\u044e \u0446\u0435\u043d\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u043b\u0430\u0442\u0438\u0442\u044c. \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0435\u0448\u0435\u0432\u043e, \u044f \u0431\u0435\u0440\u0443.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043a <code>store<\/code>. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043d\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div x-data x-subscribe class=&quot;app&quot;&gt;   ... &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>Spruce \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 <code>window<\/code>. \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c store, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>Spruce.store(&lt;\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435&gt;, &lt;\u043e\u0431\u044a\u0435\u043a\u0442&gt;)<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">Spruce.store('data', {   todos: [],   inputValue: '', });<\/code><\/pre>\n<p>  <\/p>\n<p>*<em>store \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e.<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0442\u044f\u043d\u0443\u0442\u0441\u044f \u0434\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>$store.data.todos<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e Vue Options API \u2013 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 <code>data<\/code>, \u0430 \u043c\u0435\u0442\u043e\u0434\u044b \u2013 \u0432 <code>methods<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">Spruce.store('methods', {   toggleTodo: (id) =&gt; {     const todo = $store.data.todos.find((todo) =&gt; todo.id === id);     if (todo != null) {       todo.completed = !todo.completed;     }   },   addTodo: function () {     if (!$store.data.inputValue) {       return;     }     $store.data.todos.push({       id: Date.now(),       title: $store.data.inputValue,       completed: false,     });     $store.data.inputValue = '';   },   deleteTodo: function (id) {     $store.data.todos = $store.data.todos.filter((todo) =&gt; todo.id !== id);   }, });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043b\u044b\u0448\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 \u0437\u0432\u0443\u043a? \u042d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u044f\u0442 \u0437\u0443\u0431\u044b \u0443 \u0435\u0432\u0430\u043d\u0433\u0435\u043b\u0438\u0441\u0442\u043e\u0432 \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0417\u0434\u0435\u0441\u044c \u0435\u0451 \u043d\u0435\u0442, \u043e\u043d\u0430 \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u044b \u043d\u0435 \u0442\u0435. \u0418\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0434\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u0443. \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u0443\u0440\u043e\u0432\u043d\u044f Alpine.<\/p>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u0448 template.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div x-data x-subscribe class=&quot;app&quot;&gt;   &lt;h1&gt;\u041f\u043b\u0430\u043d\u044b \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f:&lt;\/h1&gt;   &lt;ul&gt;     &lt;template x-for=&quot;todo in $store.data.todos&quot; :key=&quot;todo.id&quot;&gt;       &lt;li @click=&quot;$store.methods.toggleTodo(todo.id)&quot; :class=&quot;{'completed': todo.completed}&quot;&gt;         &lt;span x-text=&quot;todo.title&quot; class=&quot;title&quot;&gt;&lt;\/span&gt;         &lt;span @click=&quot;$store.methods.deleteTodo(todo.id)&quot; class=&quot;delete-todo&quot;&gt;&amp;times;&lt;\/span&gt;       &lt;\/li&gt;     &lt;\/template&gt;   &lt;\/ul&gt;   &lt;div class=&quot;add-todo&quot;&gt;     &lt;input type=&quot;text&quot; x-model=&quot;$store.data.inputValue&quot; placeholder=&quot;\u041d\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430&quot; \/&gt;     &lt;button @click=&quot;$store.methods.addTodo()&quot;&gt;\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c&lt;\/button&gt;   &lt;\/div&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0442\u0440\u0438\u0445 \u2013 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 API. \u0412 Spruce \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0415\u0441\u043b\u0438 <code>Spruce.on(&lt;\u0441\u043e\u0431\u044b\u0442\u0438\u0435&gt;, &lt;\u043a\u043e\u043b\u0431\u044d\u043a&gt;)<\/code> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043d\u0430\u0432\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0442\u043e <code>Spruce.once(&lt;\u0441\u043e\u0431\u044b\u0442\u0438\u0435&gt;, &lt;\u043a\u043e\u043b\u0431\u044d\u043a&gt;)<\/code> \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u0421\u043e\u0431\u044b\u0442\u0438\u0435 <code>init<\/code> \u2013 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0438\u0449\u0435\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">Spruce.once('init', async ({ store }) =&gt; {   const response = await fetch('https:\/\/jsonplaceholder.typicode.com\/todos');   const data = await response.json();   store.data.todos = data.slice(0, 10); });<\/code><\/pre>\n<p>  <\/p>\n<p>Mission accomplished.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/codesandbox.io\/s\/to-do-list-alpinespruce-options-api-im8wt\" rel=\"nofollow\">\u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430\u0448 Options API \u0432 <a href=\"https:\/\/codesandbox.io\/s\/to-do-list-alpinespruce-composition-api-e8tct\" rel=\"nofollow\">&quot;Composition API&quot;<\/a>, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 store \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0414\u0435\u043b\u0438\u0442\u0435 \u0432\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u0430\u043a \u0437\u0430\u0431\u043b\u0430\u0433\u043e\u0440\u0430\u0441\u0441\u0443\u0434\u0438\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0432\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a <code>$store<\/code>. \u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u0444\u043e\u043d\u0435 <a href=\"https:\/\/habr.com\/ru\/news\/t\/505734\/\">\u0431\u043e\u0440\u044c\u0431\u044b \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u043c\u0438 master\/slave<\/a> \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/alpinejs\/alpine\" rel=\"nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 Alpine.js<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/alpinejs\/alpine\/blob\/master\/README.ru.md\" rel=\"nofollow\">\u0420\u0443\u0441\u0441\u043a\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Alpine.js<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/ryangjchandler\/spruce\" rel=\"nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 Spruce<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p>*<em>Photo by Jakub Kapusnak on Unsplash<\/em><\/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\/505954\/\"> https:\/\/habr.com\/ru\/post\/505954\/<\/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\/505954\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-0\/bu\/pw\/-0bupwt-1dbdv_9vs-skuvmzdpc.png\" alt=\"\u043e\u0431\u043b\u043e\u0436\u043a\u0430 \u0441\u0442\u0430\u0442\u044c\u0438\"><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/504650\/\">\u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437<\/a>, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 to-do \u043d\u0430 Alpine.js, \u043c\u0435\u043d\u044f \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u0442\u0440\u043e\u0438\u043b\u043e, \u0447\u0442\u043e, \u0445\u043e\u0442\u044c \u044f \u0438 \u043c\u043e\u0433\u0443 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u0427\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u0443\u044e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, <code>$parent<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u0438\u0445\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044f\u0438\u0446\u0430 \u0432 \u043e\u0434\u043d\u0443 \u043a\u043e\u0440\u0437\u0438\u043d\u0443. \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0435 \u0437\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043b\u0438\u0441\u044c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438. \u042f \u0445\u043e\u0442\u0435\u043b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <code>todos<\/code> \u043c\u0435\u043d\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0434\u0443\u043c\u0430\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u043e \u0432\u044b \u043d\u0435 \u043f\u0440\u0430\u0432\u044b. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u043e \u0443\u0436\u0430\u0441\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0451, \u0440\u0430\u0441\u0445\u043e\u0434\u0438\u043c\u0441\u044f? \u041d\u0435\u0442. \u042f \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u043b\u0438\u0441\u0430\u043b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043b \u043f\u0440\u043e \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <a href=\"https:\/\/github.com\/alpinejs\/alpine\/blob\/master\/README.ru.md#dispatch\" rel=\"nofollow\"><code>$dispatch<\/code><\/a>. \u041d\u0443, \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u2026 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c, \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041d\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c. \u0410 \u043f\u043e\u0442\u043e\u043c \u0435\u0449\u0435 \u043f\u0435\u0440\u0435\u043e\u0441\u043c\u044b\u0441\u043b\u0438\u043c \u0432\u0441\u0451 \u0441 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c store.<\/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-305029","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305029","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=305029"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305029\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}