0.12 exampes of responding to mouse click on canvas


#1

Can I get a pointer to examples of writing code that responds to mouse clicks on a canvas in the 0.12 world?

Another question: I see that purescript-web has ways to use DOM elements, but take something like operating with a Window. Web.HTML.Window has many operations that act on a Window, but how do I obtain a reference to the Window in the first place? I have similar questions with other uses of DOM, but maybe understanding this one issue would help.

Mike


#2

Another question: I see that purescript-web has ways to use DOM elements, but take something like operating with a Window. Web.HTML.Window has many operations that act on a Window, but how do I obtain a reference to the Window in the first place?

You start here: https://pursuit.purescript.org/packages/purescript-web-html/2.0.0/docs/Web.HTML#v:window like so:

main = do
  window <- HTML.window
  doSomethingWithWindow window