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

support for attaching event handler to virtual-dom #5

Open
wavewave opened this issue Mar 15, 2015 · 4 comments
Open

support for attaching event handler to virtual-dom #5

wavewave opened this issue Mar 15, 2015 · 4 comments

Comments

@wavewave
Copy link
Member

The newest version of virtual-dom supports event handling using dom-delegator library. Here is a nice writeup on the inner-working of virtual-dom and dom-delegator which is used in the mercury MVC framework : Raynos/mercury#151

I started implementing FFI binding to dom-delegator in http://github.com/wavewave/ghcjs-dom-delegator
I will keep my progress posted here.

@wavewave
Copy link
Member Author

I also created a pull request #4 making ghcjs-vdom compatible with the newest virtual-dom (2.0.1 as of now)

@wavewave
Copy link
Member Author

now ghcjs-dom-delegator has a working example (very trivial though). dom-delegator uses a global singleton Delegator. In javascript virtual-dom, h function of virtual-hyperscript automatically registers ev-blah properties as blah event handler using the global Delegator singleton. Since ghcjs-vdom does not use virtual-hyperscript, we had better have our own similar function hook. I am going to make that extension now.

@arianvp
Copy link
Contributor

arianvp commented Mar 16, 2015

nice :) . Would be nice if we could directly define what events we are handling within the node definition just like with virtual-hyperscript

@wavewave
Copy link
Member Author

First success with ghcjs-vdom and ghcjs-dom-delegator! My WIP is on registerevent branch of my repo.

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