File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,8 @@ module Miso.FFI
101101 , inline
102102 -- ** Scroll
103103 , scrollIntoView
104+ -- ** Fullscreen
105+ , requestFullscreen
104106 -- ** SplitMix32
105107 , splitmix32
106108 -- ** Math.random()
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ module Miso.FFI.Internal
7979 , select
8080 , setSelectionRange
8181 , scrollIntoView
82+ , requestFullscreen
8283 , alert
8384 , locationReload
8485 -- * CSS
@@ -563,6 +564,22 @@ scrollIntoView elId = do
563564 _ <- el # " scrollIntoView" $ ()
564565 pure ()
565566-----------------------------------------------------------------------------
567+ -- | Calls @document.documentElement.requestFullscreen()@, falling back to
568+ -- @webkitRequestFullscreen@ for Safari.
569+ requestFullscreen :: IO ()
570+ {-# INLINABLE requestFullscreen #-}
571+ requestFullscreen = do
572+ doc <- jsg " document"
573+ docEl <- doc ! " documentElement"
574+ rfs <- docEl ! " requestFullscreen"
575+ undef <- isUndefined rfs
576+ if not undef
577+ then void $ docEl # " requestFullscreen" $ ()
578+ else do
579+ wrfs <- docEl ! " webkitRequestFullscreen"
580+ wundef <- isUndefined wrfs
581+ when (not wundef) $ void $ docEl # " webkitRequestFullscreen" $ ()
582+ -----------------------------------------------------------------------------
566583-- | Calls the @alert()@ function.
567584alert :: MisoString -> IO ()
568585{-# INLINABLE alert #-}
You can’t perform that action at this time.
0 commit comments