Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncCallback - performance and related questions #99

Open
saurabhnanda opened this issue Aug 4, 2017 · 1 comment
Open

asyncCallback - performance and related questions #99

saurabhnanda opened this issue Aug 4, 2017 · 1 comment

Comments

@saurabhnanda
Copy link

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.)

  • If said callbacks are JS => Haskell callbacks, what kind of performance can one expect?
  • When should one call releaseCallback on such callbacks? Would they be automatically released if the underlying DOM node (on which click/keypress/hover callbacks are registered) is destroyed?
@wereHamster
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants