{-# LANGUAGE PatternSynonyms #-} -- For HasCallStack compatibility {-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} module JSDOM.Generated.MediaKeys (newMediaKeys, createSession, createSession_, createSessionUnsafe, createSessionUnchecked, isTypeSupported, isTypeSupported_, getKeySystem, MediaKeys(..), gTypeMediaKeys) where import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..)) import qualified Prelude (error) import Data.Typeable (Typeable) import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, new, array) import Data.Int (Int64) import Data.Word (Word, Word64) import JSDOM.Types import Control.Applicative ((<$>)) import Control.Monad (void) import Control.Lens.Operators ((^.)) import JSDOM.EventTargetClosures (EventName, unsafeEventName) import JSDOM.Enums -- | newMediaKeys :: (MonadDOM m, ToJSString keySystem) => keySystem -> m MediaKeys newMediaKeys keySystem = liftDOM (MediaKeys <$> new (jsg "MediaKeys") [toJSVal keySystem]) -- | createSession :: (MonadDOM m, ToJSString type', IsUint8Array initData) => MediaKeys -> type' -> Maybe initData -> m (Maybe MediaKeySession) createSession self type' initData = liftDOM ((self ^. jsf "createSession" [toJSVal type', toJSVal initData]) >>= fromJSVal) -- | createSession_ :: (MonadDOM m, ToJSString type', IsUint8Array initData) => MediaKeys -> type' -> Maybe initData -> m () createSession_ self type' initData = liftDOM (void (self ^. jsf "createSession" [toJSVal type', toJSVal initData])) -- | createSessionUnsafe :: (MonadDOM m, ToJSString type', IsUint8Array initData, HasCallStack) => MediaKeys -> type' -> Maybe initData -> m MediaKeySession createSessionUnsafe self type' initData = liftDOM (((self ^. jsf "createSession" [toJSVal type', toJSVal initData]) >>= fromJSVal) >>= maybe (Prelude.error "Nothing to return") return) -- | createSessionUnchecked :: (MonadDOM m, ToJSString type', IsUint8Array initData) => MediaKeys -> type' -> Maybe initData -> m MediaKeySession createSessionUnchecked self type' initData = liftDOM ((self ^. jsf "createSession" [toJSVal type', toJSVal initData]) >>= fromJSValUnchecked) -- | isTypeSupported :: (MonadDOM m, ToJSString keySystem, ToJSString type') => MediaKeys -> keySystem -> type' -> m Bool isTypeSupported self keySystem type' = liftDOM ((self ^. jsf "isTypeSupported" [toJSVal keySystem, toJSVal type']) >>= valToBool) -- | isTypeSupported_ :: (MonadDOM m, ToJSString keySystem, ToJSString type') => MediaKeys -> keySystem -> type' -> m () isTypeSupported_ self keySystem type' = liftDOM (void (self ^. jsf "isTypeSupported" [toJSVal keySystem, toJSVal type'])) -- | getKeySystem :: (MonadDOM m, FromJSString result) => MediaKeys -> m result getKeySystem self = liftDOM ((self ^. js "keySystem") >>= fromJSValUnchecked)