packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/AnimationPlaybackEvent.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from web-animations-2 (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.AnimationPlaybackEvent
       (js_newAnimationPlaybackEvent, js_getCurrentTime, js_getTimelineTime, newAnimationPlaybackEvent, getCurrentTime, getCurrentTimeUnsafe, getCurrentTimeUnchecked, getTimelineTime, getTimelineTimeUnsafe, getTimelineTimeUnchecked, AnimationPlaybackEvent(..), gTypeAnimationPlaybackEvent)
       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, $2) => { return new globalThis[\"AnimationPlaybackEvent\"]($1, $2); })"
        js_newAnimationPlaybackEvent :: JSString -> JSVal -> IO AnimationPlaybackEvent
-- | <https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/AnimationPlaybackEvent MDN AnimationPlaybackEvent. documentation>
newAnimationPlaybackEvent :: (MonadDOM m, ToJSString type') => type' -> Maybe AnimationPlaybackEventInit -> m AnimationPlaybackEvent
newAnimationPlaybackEvent type' eventInitDict = liftDOM (((P.maybe (P.return jsUndefined) toJSVal eventInitDict) >>= \a2' -> js_newAnimationPlaybackEvent (toJSString type') a2'))

foreign import javascript unsafe "(($1) => { return $1[\"currentTime\"]; })"
        js_getCurrentTime :: AnimationPlaybackEvent -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/currentTime MDN AnimationPlaybackEvent.currentTime documentation>
getCurrentTime :: (MonadDOM m) => AnimationPlaybackEvent -> m (Maybe CSSNumberish)
getCurrentTime self = liftDOM (((js_getCurrentTime (self)) >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/currentTime MDN AnimationPlaybackEvent.currentTime documentation>
getCurrentTimeUnsafe :: (MonadDOM m, HasCallStack) => AnimationPlaybackEvent -> m CSSNumberish
getCurrentTimeUnsafe self = liftDOM ((((js_getCurrentTime (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/currentTime MDN AnimationPlaybackEvent.currentTime documentation>
getCurrentTimeUnchecked :: (MonadDOM m) => AnimationPlaybackEvent -> m CSSNumberish
getCurrentTimeUnchecked self = liftDOM ((pFromJSVal <$> (js_getCurrentTime (self))))

foreign import javascript unsafe "(($1) => { return $1[\"timelineTime\"]; })"
        js_getTimelineTime :: AnimationPlaybackEvent -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/timelineTime MDN AnimationPlaybackEvent.timelineTime documentation>
getTimelineTime :: (MonadDOM m) => AnimationPlaybackEvent -> m (Maybe CSSNumberish)
getTimelineTime self = liftDOM (((js_getTimelineTime (self)) >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/timelineTime MDN AnimationPlaybackEvent.timelineTime documentation>
getTimelineTimeUnsafe :: (MonadDOM m, HasCallStack) => AnimationPlaybackEvent -> m CSSNumberish
getTimelineTimeUnsafe self = liftDOM ((((js_getTimelineTime (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/timelineTime MDN AnimationPlaybackEvent.timelineTime documentation>
getTimelineTimeUnchecked :: (MonadDOM m) => AnimationPlaybackEvent -> m CSSNumberish
getTimelineTimeUnchecked self = liftDOM ((pFromJSVal <$> (js_getTimelineTime (self))))