ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/SpeechRecognitionEventInit.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.SpeechRecognitionEventInit
(js_newSpeechRecognitionEventInit, js_setResultIndex, js_getResultIndex, js_setResults, js_getResults, newSpeechRecognitionEventInit, setResultIndex, getResultIndex, getResultIndexUnsafe, getResultIndexUnchecked, setResults, getResults, SpeechRecognitionEventInit(..), gTypeSpeechRecognitionEventInit)
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 ({\"results\": $1}); })"
js_newSpeechRecognitionEventInit :: SpeechRecognitionResultList -> IO SpeechRecognitionEventInit
-- | <https://webaudio.github.io/web-speech-api/#dictdef-speechrecognitioneventinit SpeechRecognitionEventInit specification>
newSpeechRecognitionEventInit :: (MonadDOM m) => SpeechRecognitionResultList -> m SpeechRecognitionEventInit
newSpeechRecognitionEventInit results = liftDOM ((js_newSpeechRecognitionEventInit (results)))
foreign import javascript safe "(($1, $2) => { $1[\"resultIndex\"] = $2; })"
js_setResultIndex :: SpeechRecognitionEventInit -> Word -> IO ()
-- | <https://webaudio.github.io/web-speech-api/#dom-speechrecognitioneventinit-resultindex SpeechRecognitionEventInit.resultIndex specification>
setResultIndex :: (MonadDOM m) => SpeechRecognitionEventInit -> Word -> m ()
setResultIndex self val = liftDOM (void ((js_setResultIndex (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"resultIndex\"]; })"
js_getResultIndex :: SpeechRecognitionEventInit -> IO JSVal
-- | <https://webaudio.github.io/web-speech-api/#dom-speechrecognitioneventinit-resultindex SpeechRecognitionEventInit.resultIndex specification>
getResultIndex :: (MonadDOM m) => SpeechRecognitionEventInit -> m (Maybe Word)
getResultIndex self = liftDOM (((js_getResultIndex (self)) >>= fromJSValUnchecked))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechrecognitioneventinit-resultindex SpeechRecognitionEventInit.resultIndex specification>
getResultIndexUnsafe :: (MonadDOM m, HasCallStack) => SpeechRecognitionEventInit -> m Word
getResultIndexUnsafe self = liftDOM ((((js_getResultIndex (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://webaudio.github.io/web-speech-api/#dom-speechrecognitioneventinit-resultindex SpeechRecognitionEventInit.resultIndex specification>
getResultIndexUnchecked :: (MonadDOM m) => SpeechRecognitionEventInit -> m Word
getResultIndexUnchecked self = liftDOM ((pFromJSVal <$> (js_getResultIndex (self))))
foreign import javascript safe "(($1, $2) => { $1[\"results\"] = $2; })"
js_setResults :: SpeechRecognitionEventInit -> SpeechRecognitionResultList -> IO ()
-- | <https://webaudio.github.io/web-speech-api/#dom-speechrecognitioneventinit-results SpeechRecognitionEventInit.results specification>
setResults :: (MonadDOM m) => SpeechRecognitionEventInit -> SpeechRecognitionResultList -> m ()
setResults self val = liftDOM (void ((js_setResults (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"results\"]; })"
js_getResults :: SpeechRecognitionEventInit -> IO SpeechRecognitionResultList
-- | <https://webaudio.github.io/web-speech-api/#dom-speechrecognitioneventinit-results SpeechRecognitionEventInit.results specification>
getResults :: (MonadDOM m) => SpeechRecognitionEventInit -> m SpeechRecognitionResultList
getResults self = liftDOM ((js_getResults (self)))