ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/ScreenOrientation.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from screen-orientation (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.ScreenOrientation
(js_lock, js_unlock, js_getType, js_getAngle, lock, unlock, getType, getAngle, change, ScreenOrientation(..), gTypeScreenOrientation)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript interruptible "(($1, $2, $c) => { return $1[\"lock\"]($2).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
js_lock :: ScreenOrientation -> JSVal -> IO (JSVal, ())
-- | <https://developer.mozilla.org/docs/Web/API/ScreenOrientation/lock MDN ScreenOrientation.lock documentation>
lock :: (MonadDOM m) => ScreenOrientation -> OrientationLockType -> m ()
lock self orientation = liftDOM (void ((((toJSVal orientation) >>= \a2' -> js_lock (self) a2') >>= checkPromiseResult)))
foreign import javascript safe "(($1) => { return $1[\"unlock\"](); })"
js_unlock :: ScreenOrientation -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/ScreenOrientation/unlock MDN ScreenOrientation.unlock documentation>
unlock :: (MonadDOM m) => ScreenOrientation -> m ()
unlock self = liftDOM (void ((js_unlock (self))))
foreign import javascript unsafe "(($1) => { return $1[\"type\"]; })"
js_getType :: ScreenOrientation -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/ScreenOrientation/type MDN ScreenOrientation.type documentation>
getType :: (MonadDOM m) => ScreenOrientation -> m OrientationType
getType self = liftDOM (((js_getType (self)) >>= fromJSValUnchecked))
foreign import javascript unsafe "(($1) => { return $1[\"angle\"]; })"
js_getAngle :: ScreenOrientation -> IO Word
-- | <https://developer.mozilla.org/docs/Web/API/ScreenOrientation/angle MDN ScreenOrientation.angle documentation>
getAngle :: (MonadDOM m) => ScreenOrientation -> m Word
getAngle self = liftDOM ((js_getAngle (self)))
-- | <https://w3c.github.io/screen-orientation/#dom-screenorientation-onchange change event>
change :: EventName ScreenOrientation Event
change = unsafeEventName (toJSString "change")