2012/5/20 Adam Chlipala <[email protected]>:
> I do expect this will work, but it might be nicer to add a new argument(s)
> to appropriate event attribute types.  Thoughts?

Looking at
https://developer.mozilla.org/en/DOM/DOM_event_reference
I think it worth to define mouseEvent and keyboardEvent types:

https://developer.mozilla.org/en/DOM/MouseEvent
con mouseEvent
  = { ScreenX : int, ScreenY : int, ClientX : int, ClientY : int
    , CtrlKey : bool, ShiftKey : bool, AltKey : bool, MetaKey : bool
    , Left : bool, Right : bool, Middle : bool }

https://developer.mozilla.org/en/DOM/KeyboardEvent
con keyboardEvent
  = { KeyCode : int, Char : string
    , CtrlKey : bool, ShiftKey : bool, AltKey : bool, MetaKey : bool }

and change onclick/ondblclick/onmouse* to
  mouseEvent -> transaction {}
and onkeydown/onkeypress/onkeyup to
  keyboardEvent -> transaction {}

Interesting possibility is to allow both (transaction {}) and (event
-> transaction {}) as event handlers, so handlers that don't need
extra argument (like most of onclick handlers) could be written
without superfluous "fn _ => ". I think it's possible through type
class mechanism.

_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to