ghcjs/ghcjs-jquery

Why there is no "ready" function?

Closed this issue · 5 comments

(cc @mgsloan )

Hey folks,

I was just wondering how come there is no ready FFI binding. Is this something automatically enforced by GHCJS or it's just an oversight?

Thanks a ton!

A.

I think it's likely just an oversight. The JQuery bindings are certainly not complete.

I don't think that the invocation of main guarantees that the DOM is ready. It might, but it'd surprise me if GHCJS did this.

In the HTML generated by GHCJS, I see

  <script language="javascript" src="runmain.js" defer></script>

I believe the defer, and the location of the script tag after the body, should be enough in most (all?) cases.

Indeed, but the generated HTML isn't always used, so your main could be invoked before the DOM is ready.

Thanks for the reply folks, I'm cooking a PR as we talk.

Argh, I started yak shaving to improve the state of example/Main.hs as the porting to improved-base broke it but I stumbled upon other issues and now is work time. I will take another stab at if either after work or tomorrow!