Skip to content

Commit

Permalink
alternative resize event taking the window
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Oct 1, 2018
1 parent 8dcf1e0 commit 26493e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Graphics/UI/Threepenny/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ())

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 26493e0

Please sign in to comment.