jsaddle-dom-0.10.0.0: src/JSDOM/Generated/TextTrackCueList.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module JSDOM.Generated.TextTrackCueList
(getCueById, getCueById_, getCueByIdUnsafe, getCueByIdUnchecked, getLength, TextTrackCueList(..), gTypeTextTrackCueList)
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/TextTrackCueList/getCueById MDN TextTrackCueList.getCueById documentation>
getCueById :: (MonadDOM m, ToJSString id) => TextTrackCueList -> id -> m (Maybe TextTrackCue)
getCueById self id = liftDOM (((self ^. jsf "getCueById" [toJSVal id]) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/TextTrackCueList/getCueById MDN TextTrackCueList.getCueById documentation>
getCueById_ :: (MonadDOM m, ToJSString id) => TextTrackCueList -> id -> m ()
getCueById_ self id = liftDOM (void (self ^. jsf "getCueById" [toJSVal id]))
-- | <https://developer.mozilla.org/docs/Web/API/TextTrackCueList/getCueById MDN TextTrackCueList.getCueById documentation>
getCueByIdUnsafe :: (MonadDOM m, ToJSString id, HasCallStack) => TextTrackCueList -> id -> m TextTrackCue
getCueByIdUnsafe self id = liftDOM ((((self ^. jsf "getCueById" [toJSVal id]) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/TextTrackCueList/getCueById MDN TextTrackCueList.getCueById documentation>
getCueByIdUnchecked :: (MonadDOM m, ToJSString id) => TextTrackCueList -> id -> m TextTrackCue
getCueByIdUnchecked self id = liftDOM (((self ^. jsf "getCueById" [toJSVal id]) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/TextTrackCueList/length MDN TextTrackCueList.length documentation>
getLength :: (MonadDOM m) => TextTrackCueList -> m Word
getLength self = liftDOM ((P.round <$> ((self ^. js "length") >>= valToNumber)))