Brr: setting window.onload?

How do we set the window.onload handler via Brr ?

I am trying to convert the JSOO WebGL example to Brr, and JSOO has this line: js_of_ocaml/ at master · ocsigen/js_of_ocaml · GitHub

let _ = Dom_html.window##.onload := Dom_html.handler go

Now, I am looking at the Brr.Window documentation:

It is not obvious to me. How do we set window.onload via Brr ?


Have you seen the examples in the test folder on the GitHub mirror?

I believe this may help you: brr/ at 87424a8ea11cdcecd157ae0dcbb40ddd095a953b · dbuenzli/brr · GitHub


I stupidly missed that; that’s a goldmine of examples. Thanks!

There’s more than one way to do that but Brr’s web page howto has a suggestion and sample code.

1 Like

I see the brr webgl & brr webworker examples. Is there by chance also a brr websocket example ? Thanks!