packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webaudio-1.1 (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.AudioTimestamp
       (js_newAudioTimestamp, js_setContextTime, js_getContextTime, js_setPerformanceTime, js_getPerformanceTime, newAudioTimestamp, setContextTime, getContextTime, getContextTimeUnsafe, getContextTimeUnchecked, setPerformanceTime, getPerformanceTime, getPerformanceTimeUnsafe, getPerformanceTimeUnchecked, AudioTimestamp(..), gTypeAudioTimestamp)
       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 "(() => { return ({}); })"
        js_newAudioTimestamp :: IO AudioTimestamp
-- | <https://webaudio.github.io/web-audio-api/#AudioTimestamp AudioTimestamp specification>
newAudioTimestamp :: (MonadDOM m) => m AudioTimestamp
newAudioTimestamp = liftDOM ((js_newAudioTimestamp))

foreign import javascript safe "(($1, $2) => { $1[\"contextTime\"] = $2; })"
        js_setContextTime :: AudioTimestamp -> Double -> IO ()
-- | <https://webaudio.github.io/web-audio-api/#dom-audiotimestamp-contexttime AudioTimestamp.contextTime specification>
setContextTime :: (MonadDOM m) => AudioTimestamp -> Double -> m ()
setContextTime self val = liftDOM (void ((js_setContextTime (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"contextTime\"]; })"
        js_getContextTime :: AudioTimestamp -> IO JSVal
-- | <https://webaudio.github.io/web-audio-api/#dom-audiotimestamp-contexttime AudioTimestamp.contextTime specification>
getContextTime :: (MonadDOM m) => AudioTimestamp -> m (Maybe Double)
getContextTime self = liftDOM (((js_getContextTime (self)) >>= fromJSValUnchecked))

-- | <https://webaudio.github.io/web-audio-api/#dom-audiotimestamp-contexttime AudioTimestamp.contextTime specification>
getContextTimeUnsafe :: (MonadDOM m, HasCallStack) => AudioTimestamp -> m Double
getContextTimeUnsafe self = liftDOM ((((js_getContextTime (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://webaudio.github.io/web-audio-api/#dom-audiotimestamp-contexttime AudioTimestamp.contextTime specification>
getContextTimeUnchecked :: (MonadDOM m) => AudioTimestamp -> m Double
getContextTimeUnchecked self = liftDOM ((pFromJSVal <$> (js_getContextTime (self))))

foreign import javascript safe "(($1, $2) => { $1[\"performanceTime\"] = $2; })"
        js_setPerformanceTime :: AudioTimestamp -> Double -> IO ()
-- | <https://webaudio.github.io/web-audio-api/#dom-audiotimestamp-performancetime AudioTimestamp.performanceTime specification>
setPerformanceTime :: (MonadDOM m) => AudioTimestamp -> Double -> m ()
setPerformanceTime self val = liftDOM (void ((js_setPerformanceTime (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"performanceTime\"]; })"
        js_getPerformanceTime :: AudioTimestamp -> IO JSVal
-- | <https://webaudio.github.io/web-audio-api/#dom-audiotimestamp-performancetime AudioTimestamp.performanceTime specification>
getPerformanceTime :: (MonadDOM m) => AudioTimestamp -> m (Maybe Double)
getPerformanceTime self = liftDOM (((js_getPerformanceTime (self)) >>= fromJSValUnchecked))

-- | <https://webaudio.github.io/web-audio-api/#dom-audiotimestamp-performancetime AudioTimestamp.performanceTime specification>
getPerformanceTimeUnsafe :: (MonadDOM m, HasCallStack) => AudioTimestamp -> m Double
getPerformanceTimeUnsafe self = liftDOM ((((js_getPerformanceTime (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://webaudio.github.io/web-audio-api/#dom-audiotimestamp-performancetime AudioTimestamp.performanceTime specification>
getPerformanceTimeUnchecked :: (MonadDOM m) => AudioTimestamp -> m Double
getPerformanceTimeUnchecked self = liftDOM ((pFromJSVal <$> (js_getPerformanceTime (self))))