Skip to content

Move search into a web worker #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 3, 2017
Merged

Move search into a web worker #365

merged 5 commits into from
Jul 3, 2017

Conversation

chasenlehara
Copy link
Member

@chasenlehara chasenlehara commented Jul 3, 2017

This takes all of the Lunr code and moves it to a web worker, so the indexing and searching process doesn’t block the main thread. This also adds a loading indicator when a search is being performed, which isn’t visible if the main thread is locked, hence the need for using a web worker.

This is a WIP because:

  • the way the web worker is loaded is a terrible hack
  • the Safari exception is back 😢

Before:
before

After:
after

This takes all of the Lunr code and moves it to a web worker, so the indexing and searching process doesn’t block the main thread.

This is a WIP because the way the web worker is loaded is a terrible hack.
@imaustink
Copy link
Contributor

@chasenlehara Matthew said the proper way to setup the build file for the web worker is to just have multiple calls to stealTools in the same file, one for each output file. He also noted that we can't use an object for the stealTools config ☹️

@chasenlehara chasenlehara merged commit 4d0208f into master Jul 3, 2017
@chasenlehara chasenlehara deleted the 363-web-worker branch July 3, 2017 21:17
@chasenlehara chasenlehara changed the title WIP: Move search into a web worker Move search into a web worker Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants