Aw, shucks ๐it's very gratifying to see people get pulled into the ReasonML community/tech ecosystem and make cool stuff. And one of these days, I'll manage to ship some Reason at work tooโfingers crossed ๐
Ahhh, that's a tough one. But the library is short enough that I would rewrite in Reason completely. Many JS hacks though (I suppose for performance).
Having a Map of different types is just not possible (IMHO) in Reason. You'd need a wrapper EventHandlerList type which works for both WildCardEventHandlerList and EventHandlerList.
Sometimes, you just need to use plain JS Objects and Obj.magic, I guess, sorry.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is where I keep getting stuck.
I can't figure out how to bind to the star symbol and anything else really.
Js code is:
and can be found here:github.com/developit/mitt/blob/2ab...
Hey Alain, roughly speaking this should work:
It models the
EventHandlerMapand its values as abstract types, you can fill in more details if you know them.[EDIT: I made the
getreturn anoptionbecause a dynamic key lookup may always returnundefined.]Yawar, you really are an OCaml/Reason guru and probably the most helpful guy I ever met in any community. Keep it up!
Aw, shucks ๐it's very gratifying to see people get pulled into the ReasonML community/tech ecosystem and make cool stuff. And one of these days, I'll manage to ship some Reason at work tooโfingers crossed ๐
Ahhh, that's a tough one. But the library is short enough that I would rewrite in Reason completely. Many JS hacks though (I suppose for performance).
Having a Map of different types is just not possible (IMHO) in Reason. You'd need a wrapper EventHandlerList type which works for both WildCardEventHandlerList and EventHandlerList.
Sometimes, you just need to use plain JS Objects and Obj.magic, I guess, sorry.