blob: f2b9e6441aba261ffe5017b77719ac5539c1e69b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import docsearch from 'docsearch.js/dist/cdn/docsearch.min.js';
customElements.define(
'doc-search',
class extends HTMLElement {
connectedCallback() {
if (!this._setup) {
const apiKey = this.getAttribute('api-key');
const selector = this.getAttribute('selector');
docsearch({
apiKey: apiKey,
indexName: 'snowpack',
inputSelector: selector,
debug: true, // Set debug to true if you want to inspect the dropdown
});
this._setup = true;
}
}
},
);
|