jsaddle-dom-0.10.0.0: src/JSDOM/Generated/BlobEventInit.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from mediastream-recording (webref). Do not edit.
module JSDOM.Generated.BlobEventInit
(newBlobEventInit, setData, getData, setTimecode, getTimecode, getTimecodeUnsafe, getTimecodeUnchecked, BlobEventInit(..), gTypeBlobEventInit)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums
-- | <https://w3c.github.io/mediacapture-record/#dictdef-blobeventinit BlobEventInit specification>
newBlobEventInit :: (MonadDOM m, IsBlob data') => data' -> m BlobEventInit
newBlobEventInit data' = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "data" (toJSVal data')) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-data BlobEventInit.data specification>
setData :: (MonadDOM m, IsBlob val) => BlobEventInit -> val -> m ()
setData self val = liftDOM (void (self ^. jss "data" (toJSVal val)))
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-data BlobEventInit.data specification>
getData :: (MonadDOM m) => BlobEventInit -> m Blob
getData self = liftDOM (((self ^. js "data") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-timecode BlobEventInit.timecode specification>
setTimecode :: (MonadDOM m) => BlobEventInit -> Double -> m ()
setTimecode self val = liftDOM (void (self ^. jss "timecode" (toJSVal val)))
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-timecode BlobEventInit.timecode specification>
getTimecode :: (MonadDOM m) => BlobEventInit -> m (Maybe Double)
getTimecode self = liftDOM (((self ^. js "timecode") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-timecode BlobEventInit.timecode specification>
getTimecodeUnsafe :: (MonadDOM m, HasCallStack) => BlobEventInit -> m Double
getTimecodeUnsafe self = liftDOM ((((self ^. js "timecode") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-timecode BlobEventInit.timecode specification>
getTimecodeUnchecked :: (MonadDOM m) => BlobEventInit -> m Double
getTimecodeUnchecked self = liftDOM (((self ^. js "timecode") >>= valToNumber))