Open saurabhnanda opened 7 years ago
My approach is to export one callback at application startup, capture events at the root of the document (ie. add a single event listener to document.body
), and dispatch the event manually to the correct place inside the Haskell code. That way JS/DOM doesn't have to retain any references to Haskell values, and I don't have to export/release tons of callbacks while the application is running.
Context: How would callback heavy code perform under GHCJS? For example, most Elm-like architectures require a callback to triggered on almost every user-interaction to update the model state (eg. keypress in an input, on-hover to add/remove classes, etc.)
releaseCallback
on such callbacks? Would they be automatically released if the underlying DOM node (on which click/keypress/hover callbacks are registered) is destroyed?