File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,18 +45,18 @@ title: hyperscript
4545 end
4646 end
4747
48- on input debounced at 200ms
48+ on input
4949 if my value is ''
5050 empty #search-results
5151 add .hidden to #search-results
5252 exit
5353 end
54- set val to my value
55- set response to pagefind.search(val)
56- set items to response.results[0 .. 9]
54+ set response to pagefind.debouncedSearch(my value, 200)
55+ if response is null exit
56+ set items to response.results[0 .. 4]
57+ set datas to Promise.all(items.map(\ item -> item.data()))
5758 set output to ''
58- repeat for item in items
59- set info to item.data()
59+ repeat for info in datas
6060 set output to output + '<a class=\'search-result\' href=\'' + info.url + '\'>'
6161 + '<span class=\'search-result-title\'>' + info.meta.title + '</span>'
6262 + '<span class=\'search-result-excerpt\'>' + info.excerpt + '</span>'
@@ -129,7 +129,6 @@ title: hyperscript
129129<script type =" module" >
130130 window .pagefind = await import (" /pagefind/pagefind.js" );
131131 window .pagefind .init ();
132- window .pagefind .preload (' a' );
133132 </script >
134133</body >
135134</html >
You can’t perform that action at this time.
0 commit comments