ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/SpeechSynthesisUtterance.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from speech-api (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.SpeechSynthesisUtterance
(js_newSpeechSynthesisUtterance, js_setText, js_getText, js_setLang, js_getLang, js_setVoice, js_getVoice, js_setVolume, js_getVolume, js_setRate, js_getRate, js_setPitch, js_getPitch, 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 ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(($1) => { return new globalThis[\"SpeechSynthesisUtterance\"]($1); })"
js_newSpeechSynthesisUtterance :: (Optional JSString) -> IO SpeechSynthesisUtterance
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/SpeechSynthesisUtterance MDN SpeechSynthesisUtterance. documentation>
newSpeechSynthesisUtterance :: (MonadDOM m, ToJSString text) => Maybe text -> m SpeechSynthesisUtterance
newSpeechSynthesisUtterance text = liftDOM ((js_newSpeechSynthesisUtterance (toOptionalJSString text)))
foreign import javascript safe "(($1, $2) => { $1[\"text\"] = $2; })"
js_setText :: SpeechSynthesisUtterance -> JSString -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/text MDN SpeechSynthesisUtterance.text documentation>
setText :: (MonadDOM m, ToJSString val) => SpeechSynthesisUtterance -> val -> m ()
setText self val = liftDOM (void ((js_setText (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"text\"]; })"
js_getText :: SpeechSynthesisUtterance -> IO JSString
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/text MDN SpeechSynthesisUtterance.text documentation>
getText :: (MonadDOM m, FromJSString result) => SpeechSynthesisUtterance -> m result
getText self = liftDOM ((fromJSString <$> (js_getText (self))))
foreign import javascript safe "(($1, $2) => { $1[\"lang\"] = $2; })"
js_setLang :: SpeechSynthesisUtterance -> JSString -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/lang MDN SpeechSynthesisUtterance.lang documentation>
setLang :: (MonadDOM m, ToJSString val) => SpeechSynthesisUtterance -> val -> m ()
setLang self val = liftDOM (void ((js_setLang (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"lang\"]; })"
js_getLang :: SpeechSynthesisUtterance -> IO JSString
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/lang MDN SpeechSynthesisUtterance.lang documentation>
getLang :: (MonadDOM m, FromJSString result) => SpeechSynthesisUtterance -> m result
getLang self = liftDOM ((fromJSString <$> (js_getLang (self))))
foreign import javascript safe "(($1, $2) => { $1[\"voice\"] = $2; })"
js_setVoice :: SpeechSynthesisUtterance -> JSVal -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/voice MDN SpeechSynthesisUtterance.voice documentation>
setVoice :: (MonadDOM m) => SpeechSynthesisUtterance -> Maybe SpeechSynthesisVoice -> m ()
setVoice self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setVoice (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"voice\"]; })"
js_getVoice :: SpeechSynthesisUtterance -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/voice MDN SpeechSynthesisUtterance.voice documentation>
getVoice :: (MonadDOM m) => SpeechSynthesisUtterance -> m (Maybe SpeechSynthesisVoice)
getVoice self = liftDOM (((js_getVoice (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/voice MDN SpeechSynthesisUtterance.voice documentation>
getVoiceUnsafe :: (MonadDOM m, HasCallStack) => SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnsafe self = liftDOM ((((js_getVoice (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/voice MDN SpeechSynthesisUtterance.voice documentation>
getVoiceUnchecked :: (MonadDOM m) => SpeechSynthesisUtterance -> m SpeechSynthesisVoice
getVoiceUnchecked self = liftDOM ((pFromJSVal <$> (js_getVoice (self))))
foreign import javascript safe "(($1, $2) => { $1[\"volume\"] = $2; })"
js_setVolume :: SpeechSynthesisUtterance -> Float -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/volume MDN SpeechSynthesisUtterance.volume documentation>
setVolume :: (MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setVolume self val = liftDOM (void ((js_setVolume (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"volume\"]; })"
js_getVolume :: SpeechSynthesisUtterance -> IO Float
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/volume MDN SpeechSynthesisUtterance.volume documentation>
getVolume :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getVolume self = liftDOM ((js_getVolume (self)))
foreign import javascript safe "(($1, $2) => { $1[\"rate\"] = $2; })"
js_setRate :: SpeechSynthesisUtterance -> Float -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/rate MDN SpeechSynthesisUtterance.rate documentation>
setRate :: (MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setRate self val = liftDOM (void ((js_setRate (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"rate\"]; })"
js_getRate :: SpeechSynthesisUtterance -> IO Float
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/rate MDN SpeechSynthesisUtterance.rate documentation>
getRate :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getRate self = liftDOM ((js_getRate (self)))
foreign import javascript safe "(($1, $2) => { $1[\"pitch\"] = $2; })"
js_setPitch :: SpeechSynthesisUtterance -> Float -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/pitch MDN SpeechSynthesisUtterance.pitch documentation>
setPitch :: (MonadDOM m) => SpeechSynthesisUtterance -> Float -> m ()
setPitch self val = liftDOM (void ((js_setPitch (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"pitch\"]; })"
js_getPitch :: SpeechSynthesisUtterance -> IO Float
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisUtterance/pitch MDN SpeechSynthesisUtterance.pitch documentation>
getPitch :: (MonadDOM m) => SpeechSynthesisUtterance -> m Float
getPitch self = liftDOM ((js_getPitch (self)))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesisutterance-onstart start event>
start :: EventName SpeechSynthesisUtterance SpeechSynthesisEvent
start = unsafeEventName (toJSString "start")
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesisutterance-onend end event>
end :: EventName SpeechSynthesisUtterance SpeechSynthesisEvent
end = unsafeEventName (toJSString "end")
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesisutterance-onerror error event>
error :: EventName SpeechSynthesisUtterance SpeechSynthesisErrorEvent
error = unsafeEventNameAsync (toJSString "error")
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesisutterance-onpause pause event>
pause :: EventName SpeechSynthesisUtterance SpeechSynthesisEvent
pause = unsafeEventName (toJSString "pause")
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesisutterance-onresume resume event>
resume :: EventName SpeechSynthesisUtterance SpeechSynthesisEvent
resume = unsafeEventName (toJSString "resume")
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesisutterance-onmark mark event>
mark :: EventName SpeechSynthesisUtterance SpeechSynthesisEvent
mark = unsafeEventName (toJSString "mark")
-- | <https://webaudio.github.io/web-speech-api/#dom-speechsynthesisutterance-onboundary boundary event>
boundary :: EventName SpeechSynthesisUtterance SpeechSynthesisEvent
boundary = unsafeEventName (toJSString "boundary")