Lwt and/or Threads in browser


#1

Let’s say you wanted to switch out ocsigen/lwt from a backend project with something that works in the browser. Or needed to replace the Thread package.

What are the spiritual equivalents in the browser?

Thank you.


#2

The spiritual equivalent of Lwt in the browser is … Lwt, if you’re using Js_of_ocaml. It compiles Lwt directly to JS :slight_smile:

If you’re looking for something more native to the browser, there are JS Promises which work very similarly to Lwt, actually (promises run by a scheduler, on a single core).

But if you’re looking to replace Thread, as far as I know there is no equivalent for the browser.


#3

Damn, man. Just like that. Let me look in to that.


#4

Can you use Lwt as a lib on the js side is really the question. Like mzp/bs-lwt apparently does on an old version?