{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.MediaKeySession
(generateRequest, load, load_, update, close, remove, getSessionId,
getExpiration, getClosed, getKeyStatuses, keystatuseschange,
message, MediaKeySession(..), gTypeMediaKeySession)
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 Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
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, unsafeEventNameAsync)
import JSDOM.Enums
generateRequest ::
(MonadDOM m, ToJSString initDataType, IsBufferSource initData) =>
MediaKeySession -> initDataType -> initData -> m ()
generateRequest self initDataType initData
= liftDOM
(void
((self ^. jsf "generateRequest"
[toJSVal initDataType, toJSVal initData])
>>= readPromise))
load ::
(MonadDOM m, ToJSString sessionId) =>
MediaKeySession -> sessionId -> m Bool
load self sessionId
= liftDOM
(((self ^. jsf "load" [toJSVal sessionId]) >>= readPromise) >>=
fromJSValUnchecked)
load_ ::
(MonadDOM m, ToJSString sessionId) =>
MediaKeySession -> sessionId -> m ()
load_ self sessionId
= liftDOM (void (self ^. jsf "load" [toJSVal sessionId]))
update ::
(MonadDOM m, IsBufferSource response) =>
MediaKeySession -> response -> m ()
update self response
= liftDOM
(void ((self ^. jsf "update" [toJSVal response]) >>= readPromise))
close :: (MonadDOM m) => MediaKeySession -> m ()
close self
= liftDOM (void ((self ^. jsf "close" ()) >>= readPromise))
remove :: (MonadDOM m) => MediaKeySession -> m ()
remove self
= liftDOM (void ((self ^. jsf "remove" ()) >>= readPromise))
getSessionId ::
(MonadDOM m, FromJSString result) => MediaKeySession -> m result
getSessionId self
= liftDOM ((self ^. js "sessionId") >>= fromJSValUnchecked)
getExpiration :: (MonadDOM m) => MediaKeySession -> m Double
getExpiration self
= liftDOM ((self ^. js "expiration") >>= valToNumber)
getClosed :: (MonadDOM m) => MediaKeySession -> m ()
getClosed self
= liftDOM (void ((self ^. js "closed") >>= readPromise))
getKeyStatuses ::
(MonadDOM m) => MediaKeySession -> m MediaKeyStatusMap
getKeyStatuses self
= liftDOM ((self ^. js "keyStatuses") >>= fromJSValUnchecked)
keystatuseschange :: EventName MediaKeySession onkeystatuseschange
keystatuseschange
= unsafeEventName (toJSString "keystatuseschange")
message :: EventName MediaKeySession MessageEvent
message = unsafeEventNameAsync (toJSString "message")