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/webgldemo.ml 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:
https://erratique.ch/software/brr/doc/Brr/Window/index.html

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

Thanks!

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

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

2 Likes

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!