jsaddle-dom-0.10.0.0: src/JSDOM/Generated/SpeechSynthesisEventInit.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from speech-api (webref). Do not edit.
module JSDOM.Generated.SpeechSynthesisEventInit
(newSpeechSynthesisEventInit, setUtterance, getUtterance, setCharIndex, getCharIndex, getCharIndexUnsafe, getCharIndexUnchecked, setCharLength, getCharLength, getCharLengthUnsafe, getCharLengthUnchecked, setElapsedTime, getElapsedTime, getElapsedTimeUnsafe, getElapsedTimeUnchecked, setName, getName, getNameUnsafe, getNameUnchecked, SpeechSynthesisEventInit(..), gTypeSpeechSynthesisEventInit, IsSpeechSynthesisEventInit, toSpeechSynthesisEventInit)
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://webaudio.github.io/web-speech-api/#dictdef-speechsynthesiseventinit SpeechSynthesisEventInit specification>
newSpeechSynthesisEventInit :: (MonadDOM m) => SpeechSynthesisUtterance -> m SpeechSynthesisEventInit
newSpeechSynthesisEventInit utterance = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "utterance" (toJSVal utterance)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-utterance SpeechSynthesisEventInit.utterance specification>
setUtterance :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> SpeechSynthesisUtterance -> m ()
setUtterance self val = liftDOM (void ((Types.toSpeechSynthesisEventInit self) ^. jss "utterance" (toJSVal val)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-utterance SpeechSynthesisEventInit.utterance specification>
getUtterance :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> m SpeechSynthesisUtterance
getUtterance self = liftDOM ((((Types.toSpeechSynthesisEventInit self) ^. js "utterance") >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-charindex SpeechSynthesisEventInit.charIndex specification>
setCharIndex :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> Word -> m ()
setCharIndex self val = liftDOM (void ((Types.toSpeechSynthesisEventInit self) ^. jss "charIndex" (toJSVal val)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-charindex SpeechSynthesisEventInit.charIndex specification>
getCharIndex :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> m (Maybe Word)
getCharIndex self = liftDOM ((((Types.toSpeechSynthesisEventInit self) ^. js "charIndex") >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-charindex SpeechSynthesisEventInit.charIndex specification>
getCharIndexUnsafe :: (MonadDOM m, IsSpeechSynthesisEventInit self, HasCallStack) => self -> m Word
getCharIndexUnsafe self = liftDOM (((((Types.toSpeechSynthesisEventInit self) ^. js "charIndex") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-charindex SpeechSynthesisEventInit.charIndex specification>
getCharIndexUnchecked :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> m Word
getCharIndexUnchecked self = liftDOM ((P.round <$> (((Types.toSpeechSynthesisEventInit self) ^. js "charIndex") >>= valToNumber)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-charlength SpeechSynthesisEventInit.charLength specification>
setCharLength :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> Word -> m ()
setCharLength self val = liftDOM (void ((Types.toSpeechSynthesisEventInit self) ^. jss "charLength" (toJSVal val)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-charlength SpeechSynthesisEventInit.charLength specification>
getCharLength :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> m (Maybe Word)
getCharLength self = liftDOM ((((Types.toSpeechSynthesisEventInit self) ^. js "charLength") >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-charlength SpeechSynthesisEventInit.charLength specification>
getCharLengthUnsafe :: (MonadDOM m, IsSpeechSynthesisEventInit self, HasCallStack) => self -> m Word
getCharLengthUnsafe self = liftDOM (((((Types.toSpeechSynthesisEventInit self) ^. js "charLength") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-charlength SpeechSynthesisEventInit.charLength specification>
getCharLengthUnchecked :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> m Word
getCharLengthUnchecked self = liftDOM ((P.round <$> (((Types.toSpeechSynthesisEventInit self) ^. js "charLength") >>= valToNumber)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-elapsedtime SpeechSynthesisEventInit.elapsedTime specification>
setElapsedTime :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> Float -> m ()
setElapsedTime self val = liftDOM (void ((Types.toSpeechSynthesisEventInit self) ^. jss "elapsedTime" (toJSVal val)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-elapsedtime SpeechSynthesisEventInit.elapsedTime specification>
getElapsedTime :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> m (Maybe Float)
getElapsedTime self = liftDOM ((((Types.toSpeechSynthesisEventInit self) ^. js "elapsedTime") >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-elapsedtime SpeechSynthesisEventInit.elapsedTime specification>
getElapsedTimeUnsafe :: (MonadDOM m, IsSpeechSynthesisEventInit self, HasCallStack) => self -> m Float
getElapsedTimeUnsafe self = liftDOM (((((Types.toSpeechSynthesisEventInit self) ^. js "elapsedTime") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-elapsedtime SpeechSynthesisEventInit.elapsedTime specification>
getElapsedTimeUnchecked :: (MonadDOM m, IsSpeechSynthesisEventInit self) => self -> m Float
getElapsedTimeUnchecked self = liftDOM ((P.realToFrac <$> (((Types.toSpeechSynthesisEventInit self) ^. js "elapsedTime") >>= valToNumber)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-name SpeechSynthesisEventInit.name specification>
setName :: (MonadDOM m, IsSpeechSynthesisEventInit self, ToJSString val) => self -> val -> m ()
setName self val = liftDOM (void ((Types.toSpeechSynthesisEventInit self) ^. jss "name" (toJSVal val)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-name SpeechSynthesisEventInit.name specification>
getName :: (MonadDOM m, IsSpeechSynthesisEventInit self, FromJSString result) => self -> m (Maybe result)
getName self = liftDOM ((((Types.toSpeechSynthesisEventInit self) ^. js "name") >>= fromMaybeJSString))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-name SpeechSynthesisEventInit.name specification>
getNameUnsafe :: (MonadDOM m, IsSpeechSynthesisEventInit self, HasCallStack, FromJSString result) => self -> m result
getNameUnsafe self = liftDOM (((((Types.toSpeechSynthesisEventInit self) ^. js "name") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesiseventinit-name SpeechSynthesisEventInit.name specification>
getNameUnchecked :: (MonadDOM m, IsSpeechSynthesisEventInit self, FromJSString result) => self -> m result
getNameUnchecked self = liftDOM ((((Types.toSpeechSynthesisEventInit self) ^. js "name") >>= fromJSValUnchecked))