{-# 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 :: forall (m :: * -> *) text.
(MonadDOM m, ToJSString text) =>
Maybe text -> m SpeechSynthesisUtterance
newSpeechSynthesisUtterance Maybe text
text
= DOM SpeechSynthesisUtterance -> m SpeechSynthesisUtterance
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSVal -> SpeechSynthesisUtterance
SpeechSynthesisUtterance (JSVal -> SpeechSynthesisUtterance)
-> JSM JSVal -> DOM SpeechSynthesisUtterance
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
JSM JSVal -> [JSM JSVal] -> JSM JSVal
forall constructor args.
(MakeObject constructor, MakeArgs args) =>
constructor -> args -> JSM JSVal
new (String -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg String
"SpeechSynthesisUtterance") [Maybe text -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe text
text])
setText ::
(MonadDOM m, ToJSString val) =>
SpeechSynthesisUtterance -> val -> m ()
setText :: forall (m :: * -> *) val.
(MonadDOM m, ToJSString val) =>
SpeechSynthesisUtterance -> val -> m ()
setText SpeechSynthesisUtterance
self val
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (DOM ()) SpeechSynthesisUtterance (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"text" (val -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal val
val))
getText ::
(MonadDOM m, FromJSString result) =>
SpeechSynthesisUtterance -> m result
getText :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SpeechSynthesisUtterance -> m result
getText SpeechSynthesisUtterance
self = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (JSM JSVal) SpeechSynthesisUtterance (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SpeechSynthesisUtterance (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"text") JSM JSVal -> (JSVal -> DOM result) -> DOM result
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
setLang ::
(MonadDOM m, ToJSString val) =>
SpeechSynthesisUtterance -> val -> m ()
setLang :: forall (m :: * -> *) val.
(MonadDOM m, ToJSString val) =>
SpeechSynthesisUtterance -> val -> m ()
setLang SpeechSynthesisUtterance
self val
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (DOM ()) SpeechSynthesisUtterance (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"lang" (val -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal val
val))
getLang ::
(MonadDOM m, FromJSString result) =>
SpeechSynthesisUtterance -> m result
getLang :: forall (m :: * -> *) result.
(MonadDOM m, FromJSString result) =>
SpeechSynthesisUtterance -> m result
getLang SpeechSynthesisUtterance
self = DOM result -> m result
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (JSM JSVal) SpeechSynthesisUtterance (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SpeechSynthesisUtterance (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"lang") JSM JSVal -> (JSVal -> DOM result) -> DOM result
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM result
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
setVoice ::
(MonadDOM m) =>
SpeechSynthesisUtterance -> Maybe SpeechSynthesisVoice -> m ()
setVoice :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> Maybe SpeechSynthesisVoice -> m ()
setVoice SpeechSynthesisUtterance
self Maybe SpeechSynthesisVoice
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (DOM ()) SpeechSynthesisUtterance (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"voice" (Maybe SpeechSynthesisVoice -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe SpeechSynthesisVoice
val))
getVoice ::
(MonadDOM m) =>
SpeechSynthesisUtterance -> m (Maybe SpeechSynthesisVoice)
getVoice :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> m (Maybe SpeechSynthesisVoice)
getVoice SpeechSynthesisUtterance
self = DOM (Maybe SpeechSynthesisVoice) -> m (Maybe SpeechSynthesisVoice)
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (JSM JSVal) SpeechSynthesisUtterance (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SpeechSynthesisUtterance (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"voice") JSM JSVal
-> (JSVal -> DOM (Maybe SpeechSynthesisVoice))
-> DOM (Maybe SpeechSynthesisVoice)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe SpeechSynthesisVoice)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal)
getVoiceUnsafe ::
(MonadDOM m, HasCallStack) =>
SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnsafe :: forall (m :: * -> *).
(MonadDOM m, HasCallStack) =>
SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnsafe SpeechSynthesisUtterance
self
= DOM SpeechSynthesisVoice -> m SpeechSynthesisVoice
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (JSM JSVal) SpeechSynthesisUtterance (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SpeechSynthesisUtterance (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"voice") JSM JSVal
-> (JSVal -> DOM (Maybe SpeechSynthesisVoice))
-> DOM (Maybe SpeechSynthesisVoice)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe SpeechSynthesisVoice)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal) DOM (Maybe SpeechSynthesisVoice)
-> (Maybe SpeechSynthesisVoice -> DOM SpeechSynthesisVoice)
-> DOM SpeechSynthesisVoice
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
DOM SpeechSynthesisVoice
-> (SpeechSynthesisVoice -> DOM SpeechSynthesisVoice)
-> Maybe SpeechSynthesisVoice
-> DOM SpeechSynthesisVoice
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> DOM SpeechSynthesisVoice
forall a. HasCallStack => String -> a
Prelude.error String
"Nothing to return") SpeechSynthesisVoice -> DOM SpeechSynthesisVoice
forall a. a -> JSM a
forall (m :: * -> *) a. Monad m => a -> m a
return)
getVoiceUnchecked ::
(MonadDOM m) => SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnchecked :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnchecked SpeechSynthesisUtterance
self
= DOM SpeechSynthesisVoice -> m SpeechSynthesisVoice
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (JSM JSVal) SpeechSynthesisUtterance (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SpeechSynthesisUtterance (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"voice") JSM JSVal
-> (JSVal -> DOM SpeechSynthesisVoice) -> DOM SpeechSynthesisVoice
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM SpeechSynthesisVoice
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
setVolume ::
(MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setVolume :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> Float -> m ()
setVolume SpeechSynthesisUtterance
self Float
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (DOM ()) SpeechSynthesisUtterance (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"volume" (Float -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Float
val))
getVolume :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getVolume :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> m Float
getVolume SpeechSynthesisUtterance
self
= DOM Float -> m Float
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (Double -> Float) -> JSM Double -> DOM Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (JSM JSVal) SpeechSynthesisUtterance (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SpeechSynthesisUtterance (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"volume") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))
setRate ::
(MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setRate :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> Float -> m ()
setRate SpeechSynthesisUtterance
self Float
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (DOM ()) SpeechSynthesisUtterance (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"rate" (Float -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Float
val))
getRate :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getRate :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> m Float
getRate SpeechSynthesisUtterance
self
= DOM Float -> m Float
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (Double -> Float) -> JSM Double -> DOM Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (JSM JSVal) SpeechSynthesisUtterance (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SpeechSynthesisUtterance (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"rate") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))
setPitch ::
(MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setPitch :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> Float -> m ()
setPitch SpeechSynthesisUtterance
self Float
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (DOM ()) SpeechSynthesisUtterance (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"pitch" (Float -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Float
val))
getPitch :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getPitch :: forall (m :: * -> *).
MonadDOM m =>
SpeechSynthesisUtterance -> m Float
getPitch SpeechSynthesisUtterance
self
= DOM Float -> m Float
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (Double -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac (Double -> Float) -> JSM Double -> DOM Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((SpeechSynthesisUtterance
self SpeechSynthesisUtterance
-> Getting (JSM JSVal) SpeechSynthesisUtterance (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String
-> IndexPreservingGetter SpeechSynthesisUtterance (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"pitch") JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))
start :: EventName SpeechSynthesisUtterance Event
start :: EventName SpeechSynthesisUtterance Event
start = DOMString -> EventName SpeechSynthesisUtterance Event
forall t e. DOMString -> EventName t e
unsafeEventName (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"start")
end :: EventName SpeechSynthesisUtterance Event
end :: EventName SpeechSynthesisUtterance Event
end = DOMString -> EventName SpeechSynthesisUtterance Event
forall t e. DOMString -> EventName t e
unsafeEventName (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"end")
error :: EventName SpeechSynthesisUtterance UIEvent
error :: EventName SpeechSynthesisUtterance UIEvent
error = DOMString -> EventName SpeechSynthesisUtterance UIEvent
forall t e. DOMString -> EventName t e
unsafeEventNameAsync (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"error")
pause :: EventName SpeechSynthesisUtterance Event
pause :: EventName SpeechSynthesisUtterance Event
pause = DOMString -> EventName SpeechSynthesisUtterance Event
forall t e. DOMString -> EventName t e
unsafeEventName (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"pause")
resume :: EventName SpeechSynthesisUtterance Event
resume :: EventName SpeechSynthesisUtterance Event
resume = DOMString -> EventName SpeechSynthesisUtterance Event
forall t e. DOMString -> EventName t e
unsafeEventName (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"resume")
mark :: EventName SpeechSynthesisUtterance Event
mark :: EventName SpeechSynthesisUtterance Event
mark = DOMString -> EventName SpeechSynthesisUtterance Event
forall t e. DOMString -> EventName t e
unsafeEventName (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"mark")
boundary :: EventName SpeechSynthesisUtterance Event
boundary :: EventName SpeechSynthesisUtterance Event
boundary = DOMString -> EventName SpeechSynthesisUtterance Event
forall t e. DOMString -> EventName t e
unsafeEventName (String -> DOMString
forall a. ToJSString a => a -> DOMString
toJSString String
"boundary")