diff options
-rw-r--r-- | lib/js/urweb.js | 12 | ||||
-rw-r--r-- | lib/ur/basis.urs | 3 | ||||
-rw-r--r-- | src/settings.sml | 9 | ||||
-rw-r--r-- | tests/globalHandlers.ur | 6 |
4 files changed, 30 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 1f003fc3..63aab9b5 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -504,6 +504,18 @@ function uw_onMousedown(f) { uw_handler("onmousedown", f); } +function uw_onMousemove(f) { + uw_handler("onmousemove", f); +} + +function uw_onMouseout(f) { + uw_handler("onmouseout", f); +} + +function uw_onMouseover(f) { + uw_handler("onmouseover", f); +} + function uw_onMouseup(f) { uw_handler("onmouseup", f); } diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index cb5d16ea..101f8e63 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -981,6 +981,9 @@ val onKeydown : (keyEvent -> transaction unit) -> transaction unit val onKeypress : (keyEvent -> transaction unit) -> transaction unit val onKeyup : (keyEvent -> transaction unit) -> transaction unit val onMousedown : (mouseEvent -> transaction unit) -> transaction unit +val onMousemove : (mouseEvent -> transaction unit) -> transaction unit +val onMouseout : (mouseEvent -> transaction unit) -> transaction unit +val onMouseover : (mouseEvent -> transaction unit) -> transaction unit val onMouseup : (mouseEvent -> transaction unit) -> transaction unit (* Prevents default handling of current event *) diff --git a/src/settings.sml b/src/settings.sml index 9359337d..6712925f 100644 --- a/src/settings.sml +++ b/src/settings.sml @@ -174,6 +174,9 @@ val benignBase = basis ["get_cookie", "onKeypress", "onKeyup", "onMousedown", + "onMousemove", + "onMouseout", + "onMouseover", "onMouseup", "preventDefault", "stopPropagation", @@ -204,6 +207,9 @@ val clientBase = basis ["get_client_source", "onKeypress", "onKeyup", "onMousedown", + "onMousemove", + "onMouseout", + "onMouseover", "onMouseup", "preventDefault", "stopPropagation", @@ -320,6 +326,9 @@ val jsFuncsBase = basisM [("alert", "alert"), ("onKeypress", "uw_onKeypress"), ("onKeyup", "uw_onKeyup"), ("onMousedown", "uw_onMousedown"), + ("onMousemove", "uw_onMousemove"), + ("onMouseout", "uw_onMouseout"), + ("onMouseover", "uw_onMouseover"), ("onMouseup", "uw_onMouseup"), ("preventDefault", "uw_preventDefault"), ("stopPropagation", "uw_stopPropagation"), diff --git a/tests/globalHandlers.ur b/tests/globalHandlers.ur index 2b4fba7b..5ab46de8 100644 --- a/tests/globalHandlers.ur +++ b/tests/globalHandlers.ur @@ -2,3 +2,9 @@ fun main () : transaction page = return <xml> <body onload={onDblclick (fn ev => alert ("ScreenX = " ^ show ev.ScreenX ^ "\nShiftKey = " ^ show ev.ShiftKey)); onKeypress (fn ev => alert ("KeyCode = " ^ show ev.KeyCode ^ "\nShiftKey = " ^ show ev.ShiftKey))}/> </xml> + +fun busy () : transaction page = return <xml> + <body onload={onMouseout (fn _ => alert "OUT!"); + onMouseover (fn _ => alert "OVER!"); + onMousemove (fn _ => alert "MOVE!")}/> +</xml> |