Skip to content
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

Add web workers, parse automatically #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nolanlawson
Copy link
Contributor

I thought the demo might be nicer if it used web workers
to parse the grammar in the background. That way it doesn't
block the DOM, so it's a bit smoother.

Additionally, since we're not blocking the DOM, we can just
automatically re-parse the file as the user types. I set a
debounce of 700ms so that it doesn't fire too frequently. I also
removed the "Generate" button entirely, and set it up so there's a little
"Parsing..." message while it's parsing. I also made to sure to do
a fallback if web workers aren't supported in the browser (and I tested
that it works).

You can try a demo here.

web/content/assets/js/jison.js
web/crash.log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nanoc kept creating this file for some reason ^

I thought the demo might be nicer if it used web workers
to parse the grammar in the background. That way it doesn't
block the DOM, so it's a bit smoother.

Additionally, since we're not blocking the DOM, we can just
automatically re-parse the file as the user types. I set a
debounce of 700ms so that it doesn't fire too frequently. I also
removed the "Generate" button entirely, and set it up so there's a little
"Parsing..." message while it's parsing. I also made to sure to do
a fallback if web workers aren't supported in the browser (and I tested
that it works).

You can try a demo
[here](https://nolanlawson.s3.amazonaws.com/jison/try/index.html).
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.

None yet

1 participant