Open tonyfettes opened 2 weeks ago
Totally @tonyfettes. Feel free to push a PR or even a draft and ping me.
@davesnx I created a (actually two) draft PRs. Here are some questions I have in my mind after some initial attempts.
Technically worker is not part of the DOM API. Although I put them in the DOM folder, I think I should move them out of the Dom/
folder. However, I see fetch
API is in its own standalone package. Why some APIs are kept here while others are separated out (like fetch
) as standalone packages. Should I make worker APIs a package?
How can I test for the correctness of my binding? I browsed the tests/
directory, but since no typical OCaml test frameworks are used (like ounit
, alcotest
, and expect_test
), how does the tests work?
Do I really need to modify the compiler? I add some type definitions in the jscomp/others/dom.ml
and they're purely abstract type definitions. My hypothesis is they can also work if I move all these type definitions in this repo as a file, but I'm really not sure.
Thank you in advance.
Nice,
Historical reasons I would say. Since bindings have some subjective design, sometimes authors have diverged implementations. In case of fetch, could be part of this repo IMO.
Testing the browser isn't as easy as running alcotest or ounit. You would need to either run a browser (via puppetter) or a JavaScript test suit (probably jest with a bit of config to support webworkers) or manually with a demo.
Some types are abstract and inside the compiler to allow any library to extend bindings/libraries with those types. Either way, if you think the types are correct, I would push them to melange itself.
In case of fetch, could be part of this repo IMO.
I disagree. fetch
is way more useful by itself than this repo (which I've never used, though I use melange-fetch
everywhere)
Maybe you didn't need webapi?
At least I would say re_exporting fetch in webapi make sense
Maybe you didn't need webapi?
Oh I did, but this library is a bit of an overkill if you just need a few externals that are easy to write
Hi, I'm using melange for a academic project. I want to put all computation inside a worker so it doesn't froze the page. However, there is currently no support for web worker (yet?) in melange-webapi.
I have learned how to bind to JS using melange by developing the very same project, so I think I want to try to add these bindings myself. As per the contribution guidelines, I open a issue here to potentially save some work.
There is no discussion section in this repo so I might post some questions below as well to seek help & for record.