{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.SpeechSynthesis
(speak, cancel, pause, resume, getVoices, getVoices_, getPending,
getSpeaking, getPaused, SpeechSynthesis(..), gTypeSpeechSynthesis)
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
speak ::
(MonadDOM m) => SpeechSynthesis -> SpeechSynthesisUtterance -> m ()
speak :: SpeechSynthesis -> SpeechSynthesisUtterance -> m ()
speak SpeechSynthesis
self SpeechSynthesisUtterance
utterance
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf [Char]
"speak" [SpeechSynthesisUtterance -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SpeechSynthesisUtterance
utterance]))
cancel :: (MonadDOM m) => SpeechSynthesis -> m ()
cancel :: SpeechSynthesis -> m ()
cancel SpeechSynthesis
self = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> () -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf [Char]
"cancel" ()))
pause :: (MonadDOM m) => SpeechSynthesis -> m ()
pause :: SpeechSynthesis -> m ()
pause SpeechSynthesis
self = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> () -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf [Char]
"pause" ()))
resume :: (MonadDOM m) => SpeechSynthesis -> m ()
resume :: SpeechSynthesis -> m ()
resume SpeechSynthesis
self = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> () -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf [Char]
"resume" ()))
getVoices ::
(MonadDOM m) => SpeechSynthesis -> m [SpeechSynthesisVoice]
getVoices :: SpeechSynthesis -> m [SpeechSynthesisVoice]
getVoices SpeechSynthesis
self
= DOM [SpeechSynthesisVoice] -> m [SpeechSynthesisVoice]
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> () -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf [Char]
"getVoices" ()) JSM JSVal
-> (JSVal -> DOM [SpeechSynthesisVoice])
-> DOM [SpeechSynthesisVoice]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM [SpeechSynthesisVoice]
forall o. FromJSVal o => JSVal -> JSM [o]
fromJSArrayUnchecked)
getVoices_ :: (MonadDOM m) => SpeechSynthesis -> m ()
getVoices_ :: SpeechSynthesis -> m ()
getVoices_ SpeechSynthesis
self = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> () -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf [Char]
"getVoices" ()))
getPending :: (MonadDOM m) => SpeechSynthesis -> m Bool
getPending :: SpeechSynthesis -> m Bool
getPending SpeechSynthesis
self = DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter SpeechSynthesis (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"pending") JSM JSVal -> (JSVal -> DOM Bool) -> DOM Bool
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Bool
forall value. ToJSVal value => value -> DOM Bool
valToBool)
getSpeaking :: (MonadDOM m) => SpeechSynthesis -> m Bool
getSpeaking :: SpeechSynthesis -> m Bool
getSpeaking SpeechSynthesis
self = DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter SpeechSynthesis (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"speaking") JSM JSVal -> (JSVal -> DOM Bool) -> DOM Bool
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Bool
forall value. ToJSVal value => value -> DOM Bool
valToBool)
getPaused :: (MonadDOM m) => SpeechSynthesis -> m Bool
getPaused :: SpeechSynthesis -> m Bool
getPaused SpeechSynthesis
self = DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((SpeechSynthesis
self SpeechSynthesis
-> Getting (JSM JSVal) SpeechSynthesis (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. [Char] -> IndexPreservingGetter SpeechSynthesis (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js [Char]
"paused") JSM JSVal -> (JSVal -> DOM Bool) -> DOM Bool
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Bool
forall value. ToJSVal value => value -> DOM Bool
valToBool)