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

JS API is not idiomatic or documented #135

Open
andreubotella opened this issue Jul 8, 2023 · 0 comments
Open

JS API is not idiomatic or documented #135

andreubotella opened this issue Jul 8, 2023 · 0 comments

Comments

@andreubotella
Copy link

andreubotella commented Jul 8, 2023

It seems like the only way to know how to even use the JS API is to dig into the Rust code. The generated documentation at https://deno.land/x/[email protected]/mod.ts is completely useless.

I think the following changes should be made:

  • Make Parser wrap InternalParser, rather than extend it.
  • Since all of the methods of (Internal)Parser return promises, make the Parser constructor synchronous and initialize the wasm module on the first method call. We can still keep createInstance for backward compatibility.
  • Can we make Parser::parse take a ReadableStream<Uint8Array> and have it acquire a BYOB reader, rather than take the BYOB reader? Or maybe have the JS-side parse method wrapper take a ReadableStream<Uint8Array> | ReadableStreamByobReader.
  • Making Parser a wrapper class would take care of having the methods and their argument/return types in the documentation, but there needs to be more documentation on top of that.
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

No branches or pull requests

1 participant