From 26493e0a703da9c1ed3988fb4366fa149a7af4cf Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Wed, 11 Jul 2018 13:36:54 +0200 Subject: [PATCH] alternative resize event taking the window --- src/Graphics/UI/Threepenny/Events.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Graphics/UI/Threepenny/Events.hs b/src/Graphics/UI/Threepenny/Events.hs index 7145d1e7..83768ed5 100644 --- a/src/Graphics/UI/Threepenny/Events.hs +++ b/src/Graphics/UI/Threepenny/Events.hs @@ -8,12 +8,13 @@ module Graphics.UI.Threepenny.Events ( -- * Standard DOM events click, contextmenu, mousemove, mousedown, mouseup, hover, leave, - focus, blur, resize, + focus, blur, resize, resize', KeyCode, keyup, keydown, keypress, ) where import Graphics.UI.Threepenny.Attributes import Graphics.UI.Threepenny.Core +import System.IO.Unsafe (unsafePerformIO) silence = fmap (const ()) @@ -92,6 +93,9 @@ blur = silence . domEvent "blur" -- 'resize' event registered. resize :: Element -> Event (Int,Int) resize = fmap readCoordinates . domEvent "resize" +resize' :: Window -> Event (Int,Int) +resize' w = fmap readCoordinates $ domEvent "resize" e -- do fmap readCoordinates . + where e = unsafePerformIO (runUI w $ getBody w) type KeyCode = Int