packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/ScrollTimeline.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from scroll-animations-1 (webref). Do not edit.
module JSDOM.Generated.ScrollTimeline
       (newScrollTimeline, getSource, getSourceUnsafe, getSourceUnchecked, getAxis, ScrollTimeline(..), gTypeScrollTimeline, IsScrollTimeline, toScrollTimeline)
       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/ScrollTimeline/ScrollTimeline MDN ScrollTimeline. documentation>
newScrollTimeline :: (MonadDOM m) => Maybe ScrollTimelineOptions -> m ScrollTimeline
newScrollTimeline options = liftDOM (((new (jsg "ScrollTimeline") [P.maybe (P.return jsUndefined) toJSVal options]) >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/ScrollTimeline/source MDN ScrollTimeline.source documentation>
getSource :: (MonadDOM m, IsScrollTimeline self) => self -> m (Maybe Element)
getSource self = liftDOM ((((Types.toScrollTimeline self) ^. js "source") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/ScrollTimeline/source MDN ScrollTimeline.source documentation>
getSourceUnsafe :: (MonadDOM m, IsScrollTimeline self, HasCallStack) => self -> m Element
getSourceUnsafe self = liftDOM (((((Types.toScrollTimeline self) ^. js "source") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://developer.mozilla.org/docs/Web/API/ScrollTimeline/source MDN ScrollTimeline.source documentation>
getSourceUnchecked :: (MonadDOM m, IsScrollTimeline self) => self -> m Element
getSourceUnchecked self = liftDOM ((((Types.toScrollTimeline self) ^. js "source") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/ScrollTimeline/axis MDN ScrollTimeline.axis documentation>
getAxis :: (MonadDOM m, IsScrollTimeline self) => self -> m ScrollAxis
getAxis self = liftDOM ((((Types.toScrollTimeline self) ^. js "axis") >>= fromJSValUnchecked))