jsaddle-dom-0.10.0.0: src/JSDOM/Generated/SpeechSynthesisEvent.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from speech-api (webref). Do not edit.
module JSDOM.Generated.SpeechSynthesisEvent
(newSpeechSynthesisEvent, getUtterance, getCharIndex, getCharLength, getElapsedTime, getName, SpeechSynthesisEvent(..), gTypeSpeechSynthesisEvent, IsSpeechSynthesisEvent, toSpeechSynthesisEvent)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisEvent/SpeechSynthesisEvent MDN SpeechSynthesisEvent. documentation>
newSpeechSynthesisEvent :: (MonadDOM m, ToJSString type', IsSpeechSynthesisEventInit eventInitDict) => type' -> eventInitDict -> m SpeechSynthesisEvent
newSpeechSynthesisEvent type' eventInitDict = liftDOM (((new (jsg "SpeechSynthesisEvent") [toJSVal type', toJSVal eventInitDict]) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisEvent/utterance MDN SpeechSynthesisEvent.utterance documentation>
getUtterance :: (MonadDOM m, IsSpeechSynthesisEvent self) => self -> m SpeechSynthesisUtterance
getUtterance self = liftDOM ((((Types.toSpeechSynthesisEvent self) ^. js "utterance") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisEvent/charIndex MDN SpeechSynthesisEvent.charIndex documentation>
getCharIndex :: (MonadDOM m, IsSpeechSynthesisEvent self) => self -> m Word
getCharIndex self = liftDOM ((P.round <$> (((Types.toSpeechSynthesisEvent self) ^. js "charIndex") >>= valToNumber)))
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisEvent/charLength MDN SpeechSynthesisEvent.charLength documentation>
getCharLength :: (MonadDOM m, IsSpeechSynthesisEvent self) => self -> m Word
getCharLength self = liftDOM ((P.round <$> (((Types.toSpeechSynthesisEvent self) ^. js "charLength") >>= valToNumber)))
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisEvent/elapsedTime MDN SpeechSynthesisEvent.elapsedTime documentation>
getElapsedTime :: (MonadDOM m, IsSpeechSynthesisEvent self) => self -> m Float
getElapsedTime self = liftDOM ((P.realToFrac <$> (((Types.toSpeechSynthesisEvent self) ^. js "elapsedTime") >>= valToNumber)))
-- | <https://developer.mozilla.org/docs/Web/API/SpeechSynthesisEvent/name MDN SpeechSynthesisEvent.name documentation>
getName :: (MonadDOM m, IsSpeechSynthesisEvent self, FromJSString result) => self -> m result
getName self = liftDOM ((((Types.toSpeechSynthesisEvent self) ^. js "name") >>= fromJSValUnchecked))