Fixed initialization of index for localsearch

This commit is contained in:
squidfunk 2020-03-06 12:02:38 +01:00
parent 184e5f24e2
commit 3a25eb46d4
11 changed files with 21 additions and 20 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,10 @@
{
"assets/javascripts/bundle.js": "assets/javascripts/bundle.d76ca884.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.d76ca884.min.js.map",
"assets/javascripts/bundle.js": "assets/javascripts/bundle.14729066.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.14729066.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.dd2d8181.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.dd2d8181.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.edc88caf.min.js",
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.edc88caf.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.542c1c70.min.js",
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.542c1c70.min.js.map",
"assets/stylesheets/main.css": "assets/stylesheets/main.5ac791a0.min.css",
"assets/stylesheets/palette.css": "assets/stylesheets/palette.f5f04e6f.min.css"
}

View File

@ -179,7 +179,7 @@
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/vendor.dd2d8181.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.d76ca884.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.14729066.min.js' | url }}"></script>
{%- set translations = {} -%}
{%- for key in [
"clipboard.copy",
@ -202,7 +202,7 @@
url: {
base: "{{ base_url }}",
worker: {
search: "{{ 'assets/javascripts/worker/search.edc88caf.min.js' | url }}"
search: "{{ 'assets/javascripts/worker/search.542c1c70.min.js' | url }}"
}
},
features: {{ config.theme.features | tojson }}

View File

@ -20,15 +20,15 @@
* IN THE SOFTWARE.
*/
import { Observable, Subject, from } from "rxjs"
import { Observable, Subject, asyncScheduler, from } from "rxjs"
import { ajax } from "rxjs/ajax"
import {
map,
observeOn,
pluck,
shareReplay,
switchMap,
take,
tap,
withLatestFrom
} from "rxjs/operators"
@ -151,11 +151,12 @@ export function setupSearchWorker(
// /* Send index to worker */
// index$
.pipe<SearchSetupMessage>(
map(data => ({
.pipe(
map((data): SearchSetupMessage => ({
type: SearchMessageType.SETUP,
data
}))
})),
observeOn(asyncScheduler) // make sure it runs on the next tick
)
.subscribe(tx$.next.bind(tx$))

View File

@ -63,7 +63,7 @@ function setupLunrLanguages(config: SearchIndexConfig): void {
/* Load scripts synchronously */
if (scripts.length)
self.importScripts(
importScripts(
`${base}/min/lunr.stemmer.support.min.js`,
...scripts
)
@ -109,6 +109,6 @@ export function handler(message: SearchMessage): SearchMessage {
* Worker
* ------------------------------------------------------------------------- */
self.addEventListener("message", ev => {
self.postMessage(handler(ev.data))
addEventListener("message", ev => {
postMessage(handler(ev.data))
})