Skip to content

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.

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.

1 participant