{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.SpeechSynthesisUtterance
(newSpeechSynthesisUtterance, setText, getText, setLang, getLang,
setVoice, getVoice, getVoiceUnsafe, getVoiceUnchecked, setVolume,
getVolume, setRate, getRate, setPitch, getPitch, start, end, error,
pause, resume, mark, boundary, SpeechSynthesisUtterance(..),
gTypeSpeechSynthesisUtterance)
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
newSpeechSynthesisUtterance ::
(MonadDOM m, ToJSString text) =>
Maybe text -> m SpeechSynthesisUtterance
newSpeechSynthesisUtterance text
= liftDOM
(SpeechSynthesisUtterance <$>
new (jsg "SpeechSynthesisUtterance") [toJSVal text])
setText ::
(MonadDOM m, ToJSString val) =>
SpeechSynthesisUtterance -> val -> m ()
setText self val = liftDOM (self ^. jss "text" (toJSVal val))
getText ::
(MonadDOM m, FromJSString result) =>
SpeechSynthesisUtterance -> m result
getText self = liftDOM ((self ^. js "text") >>= fromJSValUnchecked)
setLang ::
(MonadDOM m, ToJSString val) =>
SpeechSynthesisUtterance -> val -> m ()
setLang self val = liftDOM (self ^. jss "lang" (toJSVal val))
getLang ::
(MonadDOM m, FromJSString result) =>
SpeechSynthesisUtterance -> m result
getLang self = liftDOM ((self ^. js "lang") >>= fromJSValUnchecked)
setVoice ::
(MonadDOM m) =>
SpeechSynthesisUtterance -> Maybe SpeechSynthesisVoice -> m ()
setVoice self val = liftDOM (self ^. jss "voice" (toJSVal val))
getVoice ::
(MonadDOM m) =>
SpeechSynthesisUtterance -> m (Maybe SpeechSynthesisVoice)
getVoice self = liftDOM ((self ^. js "voice") >>= fromJSVal)
getVoiceUnsafe ::
(MonadDOM m, HasCallStack) =>
SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnsafe self
= liftDOM
(((self ^. js "voice") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getVoiceUnchecked ::
(MonadDOM m) => SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnchecked self
= liftDOM ((self ^. js "voice") >>= fromJSValUnchecked)
setVolume ::
(MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setVolume self val = liftDOM (self ^. jss "volume" (toJSVal val))
getVolume :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getVolume self
= liftDOM (realToFrac <$> ((self ^. js "volume") >>= valToNumber))
setRate ::
(MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setRate self val = liftDOM (self ^. jss "rate" (toJSVal val))
getRate :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getRate self
= liftDOM (realToFrac <$> ((self ^. js "rate") >>= valToNumber))
setPitch ::
(MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setPitch self val = liftDOM (self ^. jss "pitch" (toJSVal val))
getPitch :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getPitch self
= liftDOM (realToFrac <$> ((self ^. js "pitch") >>= valToNumber))
start :: EventName SpeechSynthesisUtterance Event
start = unsafeEventName (toJSString "start")
end :: EventName SpeechSynthesisUtterance Event
end = unsafeEventName (toJSString "end")
error :: EventName SpeechSynthesisUtterance UIEvent
error = unsafeEventNameAsync (toJSString "error")
pause :: EventName SpeechSynthesisUtterance Event
pause = unsafeEventName (toJSString "pause")
resume :: EventName SpeechSynthesisUtterance Event
resume = unsafeEventName (toJSString "resume")
mark :: EventName SpeechSynthesisUtterance Event
mark = unsafeEventName (toJSString "mark")
boundary :: EventName SpeechSynthesisUtterance Event
boundary = unsafeEventName (toJSString "boundary")