packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/BlobEventInit.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from mediastream-recording (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.BlobEventInit
       (js_newBlobEventInit, js_setData, js_getData, js_setTimecode, js_getTimecode, 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 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 safe "(($1) => { return ({\"data\": $1}); })"
        js_newBlobEventInit :: Blob -> IO BlobEventInit
-- | <https://w3c.github.io/mediacapture-record/#dictdef-blobeventinit BlobEventInit specification>
newBlobEventInit :: (MonadDOM m, IsBlob data') => data' -> m BlobEventInit
newBlobEventInit data' = liftDOM ((js_newBlobEventInit (Types.toBlob data')))

foreign import javascript safe "(($1, $2) => { $1[\"data\"] = $2; })"
        js_setData :: BlobEventInit -> Blob -> IO ()
-- | <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 ((js_setData (self) (Types.toBlob val))))

foreign import javascript unsafe "(($1) => { return $1[\"data\"]; })"
        js_getData :: BlobEventInit -> IO Blob
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-data BlobEventInit.data specification>
getData :: (MonadDOM m) => BlobEventInit -> m Blob
getData self = liftDOM ((js_getData (self)))

foreign import javascript safe "(($1, $2) => { $1[\"timecode\"] = $2; })"
        js_setTimecode :: BlobEventInit -> Double -> IO ()
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-timecode BlobEventInit.timecode specification>
setTimecode :: (MonadDOM m) => BlobEventInit -> Double -> m ()
setTimecode self val = liftDOM (void ((js_setTimecode (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"timecode\"]; })"
        js_getTimecode :: BlobEventInit -> IO JSVal
-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-timecode BlobEventInit.timecode specification>
getTimecode :: (MonadDOM m) => BlobEventInit -> m (Maybe Double)
getTimecode self = liftDOM (((js_getTimecode (self)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mediacapture-record/#dom-blobeventinit-timecode BlobEventInit.timecode specification>
getTimecodeUnsafe :: (MonadDOM m, HasCallStack) => BlobEventInit -> m Double
getTimecodeUnsafe self = liftDOM ((((js_getTimecode (self)) >>= 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 ((pFromJSVal <$> (js_getTimecode (self))))