Skip to content

Commit

Permalink
further defer loading of docsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Sep 3, 2018
1 parent c35ad18 commit e7bdfb3
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/js/vendor/docsearch.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
;(function () {
var docsearch = require('docsearch.js/dist/cdn/docsearch.js')
var config = document.getElementById('search-script').dataset
var style = document.createElement('style')
style.innerText = '@import "' + config.stylesheet + '"'
document.body.appendChild(style)
docsearch({
appId: config.appId,
apiKey: config.apiKey,
indexName: config.indexName,
inputSelector: '#search-query',
algoliaOptions: { hitsPerPage: 25 },
debug: false,
})
window.setTimeout(function () {
var config = document.getElementById('search-script').dataset
var style = document.createElement('style')
style.innerText = '@import "' + config.stylesheet + '"'
document.head.appendChild(style)
docsearch({
appId: config.appId,
apiKey: config.apiKey,
indexName: config.indexName,
inputSelector: '#search-query',
algoliaOptions: { hitsPerPage: 25 },
debug: false,
})
}, 1000)
})()

0 comments on commit e7bdfb3

Please sign in to comment.