From 0a85e5a6dd71fbff08f6959f561446537c2930ae Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 4 Sep 2021 21:51:12 +0300 Subject: [PATCH] Create app.js --- .gh-pages/app.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .gh-pages/app.js diff --git a/.gh-pages/app.js b/.gh-pages/app.js new file mode 100644 index 00000000..21e655e8 --- /dev/null +++ b/.gh-pages/app.js @@ -0,0 +1,20 @@ +document.addEventListener('alpine:init', () => { + Alpine.data('list', () => ({ + isLoading: true, + query: '', + _query: '', + items: [], + + search() { + this._query = this.query.toLowerCase() + }, + + async init() { + this.items = await fetch('_items.json') + .then(response => response.json()) + .catch(console.log) + + this.isLoading = false + } + })) +})