packages feed

ghcjs-dom-javascript-0.9.9.0: src/GHCJS/DOM/JSFFI/Generated/SpeechSynthesisUtterance.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE JavaScriptFFI #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
module GHCJS.DOM.JSFFI.Generated.SpeechSynthesisUtterance
       (js_newSpeechSynthesisUtterance, newSpeechSynthesisUtterance,
        js_setText, setText, js_getText, getText, js_setLang, setLang,
        js_getLang, getLang, js_setVoice, setVoice, js_getVoice, getVoice,
        getVoiceUnsafe, getVoiceUnchecked, js_setVolume, setVolume,
        js_getVolume, getVolume, js_setRate, setRate, js_getRate, getRate,
        js_setPitch, setPitch, js_getPitch, getPitch, start, end, error,
        pause, resume, mark, boundary, SpeechSynthesisUtterance(..),
        gTypeSpeechSynthesisUtterance)
       where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, fmap, Show, Read, Eq, Ord)
import qualified Prelude (error)
import Data.Typeable (Typeable)
import GHCJS.Types (JSVal(..), JSString)
import GHCJS.Foreign (jsNull, jsUndefined)
import GHC.JS.Foreign.Callback (syncCallback, asyncCallback, syncCallback1, asyncCallback1, syncCallback2, asyncCallback2, OnBlocked(..))
import GHCJS.Marshal (ToJSVal(..), FromJSVal(..))
import GHCJS.Marshal.Pure (PToJSVal(..), PFromJSVal(..))
import Control.Monad (void)
import Control.Monad.IO.Class (MonadIO(..))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import Data.Maybe (fromJust)
import Data.Traversable (mapM)
import GHCJS.DOM.Types
import Control.Applicative ((<$>))
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
 
foreign import javascript unsafe
        "(($1) => { return new window[\"SpeechSynthesisUtterance\"]($1); })"
        js_newSpeechSynthesisUtterance ::
        Optional JSString -> IO SpeechSynthesisUtterance

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance Mozilla SpeechSynthesisUtterance documentation> 
newSpeechSynthesisUtterance ::
                            (MonadIO m, ToJSString text) =>
                              Maybe text -> m SpeechSynthesisUtterance
newSpeechSynthesisUtterance text
  = liftIO (js_newSpeechSynthesisUtterance (toOptionalJSString text))
 
foreign import javascript unsafe "(($1, $2) => { $1[\"text\"] = $2; })" js_setText ::
        SpeechSynthesisUtterance -> JSString -> IO ()

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.text Mozilla SpeechSynthesisUtterance.text documentation> 
setText ::
        (MonadIO m, ToJSString val) =>
          SpeechSynthesisUtterance -> val -> m ()
setText self val = liftIO (js_setText self (toJSString val))
 
foreign import javascript unsafe "(($1) => { return $1[\"text\"]; })" js_getText ::
        SpeechSynthesisUtterance -> IO JSString

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.text Mozilla SpeechSynthesisUtterance.text documentation> 
getText ::
        (MonadIO m, FromJSString result) =>
          SpeechSynthesisUtterance -> m result
getText self = liftIO (fromJSString <$> (js_getText self))
 
foreign import javascript unsafe "(($1, $2) => { $1[\"lang\"] = $2; })" js_setLang ::
        SpeechSynthesisUtterance -> JSString -> IO ()

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.lang Mozilla SpeechSynthesisUtterance.lang documentation> 
setLang ::
        (MonadIO m, ToJSString val) =>
          SpeechSynthesisUtterance -> val -> m ()
setLang self val = liftIO (js_setLang self (toJSString val))
 
foreign import javascript unsafe "(($1) => { return $1[\"lang\"]; })" js_getLang ::
        SpeechSynthesisUtterance -> IO JSString

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.lang Mozilla SpeechSynthesisUtterance.lang documentation> 
getLang ::
        (MonadIO m, FromJSString result) =>
          SpeechSynthesisUtterance -> m result
getLang self = liftIO (fromJSString <$> (js_getLang self))
 
foreign import javascript unsafe "(($1, $2) => { $1[\"voice\"] = $2; })" js_setVoice
        ::
        SpeechSynthesisUtterance -> Optional SpeechSynthesisVoice -> IO ()

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.voice Mozilla SpeechSynthesisUtterance.voice documentation> 
setVoice ::
         (MonadIO m) =>
           SpeechSynthesisUtterance -> Maybe SpeechSynthesisVoice -> m ()
setVoice self val = liftIO (js_setVoice self (maybeToOptional val))
 
foreign import javascript unsafe "(($1) => { return $1[\"voice\"]; })" js_getVoice ::
        SpeechSynthesisUtterance -> IO (Nullable SpeechSynthesisVoice)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.voice Mozilla SpeechSynthesisUtterance.voice documentation> 
getVoice ::
         (MonadIO m) =>
           SpeechSynthesisUtterance -> m (Maybe SpeechSynthesisVoice)
getVoice self = liftIO (nullableToMaybe <$> (js_getVoice self))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.voice Mozilla SpeechSynthesisUtterance.voice documentation> 
getVoiceUnsafe ::
               (MonadIO m, HasCallStack) =>
                 SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnsafe self
  = liftIO
      ((nullableToMaybe <$> (js_getVoice self)) >>=
         maybe (Prelude.error "Nothing to return") return)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.voice Mozilla SpeechSynthesisUtterance.voice documentation> 
getVoiceUnchecked ::
                  (MonadIO m) => SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnchecked self
  = liftIO (fromJust . nullableToMaybe <$> (js_getVoice self))
 
foreign import javascript unsafe "(($1, $2) => { $1[\"volume\"] = $2; })"
        js_setVolume :: SpeechSynthesisUtterance -> Float -> IO ()

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.volume Mozilla SpeechSynthesisUtterance.volume documentation> 
setVolume ::
          (MonadIO m) => SpeechSynthesisUtterance -> Float -> m ()
setVolume self val = liftIO (js_setVolume self val)
 
foreign import javascript unsafe "(($1) => { return $1[\"volume\"]; })" js_getVolume ::
        SpeechSynthesisUtterance -> IO Float

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.volume Mozilla SpeechSynthesisUtterance.volume documentation> 
getVolume :: (MonadIO m) => SpeechSynthesisUtterance -> m Float
getVolume self = liftIO (js_getVolume self)
 
foreign import javascript unsafe "(($1, $2) => { $1[\"rate\"] = $2; })" js_setRate ::
        SpeechSynthesisUtterance -> Float -> IO ()

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.rate Mozilla SpeechSynthesisUtterance.rate documentation> 
setRate :: (MonadIO m) => SpeechSynthesisUtterance -> Float -> m ()
setRate self val = liftIO (js_setRate self val)
 
foreign import javascript unsafe "(($1) => { return $1[\"rate\"]; })" js_getRate ::
        SpeechSynthesisUtterance -> IO Float

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.rate Mozilla SpeechSynthesisUtterance.rate documentation> 
getRate :: (MonadIO m) => SpeechSynthesisUtterance -> m Float
getRate self = liftIO (js_getRate self)
 
foreign import javascript unsafe "(($1, $2) => { $1[\"pitch\"] = $2; })" js_setPitch
        :: SpeechSynthesisUtterance -> Float -> IO ()

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.pitch Mozilla SpeechSynthesisUtterance.pitch documentation> 
setPitch ::
         (MonadIO m) => SpeechSynthesisUtterance -> Float -> m ()
setPitch self val = liftIO (js_setPitch self val)
 
foreign import javascript unsafe "(($1) => { return $1[\"pitch\"]; })" js_getPitch ::
        SpeechSynthesisUtterance -> IO Float

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.pitch Mozilla SpeechSynthesisUtterance.pitch documentation> 
getPitch :: (MonadIO m) => SpeechSynthesisUtterance -> m Float
getPitch self = liftIO (js_getPitch self)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.onstart Mozilla SpeechSynthesisUtterance.onstart documentation> 
start :: EventName SpeechSynthesisUtterance Event
start = unsafeEventName (toJSString "start")

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.onend Mozilla SpeechSynthesisUtterance.onend documentation> 
end :: EventName SpeechSynthesisUtterance Event
end = unsafeEventName (toJSString "end")

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.onerror Mozilla SpeechSynthesisUtterance.onerror documentation> 
error :: EventName SpeechSynthesisUtterance UIEvent
error = unsafeEventNameAsync (toJSString "error")

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.onpause Mozilla SpeechSynthesisUtterance.onpause documentation> 
pause :: EventName SpeechSynthesisUtterance Event
pause = unsafeEventName (toJSString "pause")

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.onresume Mozilla SpeechSynthesisUtterance.onresume documentation> 
resume :: EventName SpeechSynthesisUtterance Event
resume = unsafeEventName (toJSString "resume")

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.onmark Mozilla SpeechSynthesisUtterance.onmark documentation> 
mark :: EventName SpeechSynthesisUtterance Event
mark = unsafeEventName (toJSString "mark")

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance.onboundary Mozilla SpeechSynthesisUtterance.onboundary documentation> 
boundary :: EventName SpeechSynthesisUtterance Event
boundary = unsafeEventName (toJSString "boundary")