packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from user-timing (webref). Do not edit.
module JSDOM.Generated.PerformanceMarkOptions
       (newPerformanceMarkOptions, setDetail, getDetail, setStartTime, getStartTime, getStartTimeUnsafe, getStartTimeUnchecked, PerformanceMarkOptions(..), gTypePerformanceMarkOptions)
       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://w3c.github.io/user-timing/#dictdef-performancemarkoptions PerformanceMarkOptions specification>
newPerformanceMarkOptions :: (MonadDOM m) => m PerformanceMarkOptions
newPerformanceMarkOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/user-timing/#dom-performancemarkoptions-detail PerformanceMarkOptions.detail specification>
setDetail :: (MonadDOM m) => PerformanceMarkOptions -> JSVal -> m ()
setDetail self val = liftDOM (void (self ^. jss "detail" (toJSVal val)))

-- | <https://w3c.github.io/user-timing/#dom-performancemarkoptions-detail PerformanceMarkOptions.detail specification>
getDetail :: (MonadDOM m) => PerformanceMarkOptions -> m JSVal
getDetail self = liftDOM (self ^. js "detail")

-- | <https://w3c.github.io/user-timing/#dom-performancemarkoptions-starttime PerformanceMarkOptions.startTime specification>
setStartTime :: (MonadDOM m) => PerformanceMarkOptions -> Double -> m ()
setStartTime self val = liftDOM (void (self ^. jss "startTime" (toJSVal val)))

-- | <https://w3c.github.io/user-timing/#dom-performancemarkoptions-starttime PerformanceMarkOptions.startTime specification>
getStartTime :: (MonadDOM m) => PerformanceMarkOptions -> m (Maybe Double)
getStartTime self = liftDOM (((self ^. js "startTime") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/user-timing/#dom-performancemarkoptions-starttime PerformanceMarkOptions.startTime specification>
getStartTimeUnsafe :: (MonadDOM m, HasCallStack) => PerformanceMarkOptions -> m Double
getStartTimeUnsafe self = liftDOM ((((self ^. js "startTime") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/user-timing/#dom-performancemarkoptions-starttime PerformanceMarkOptions.startTime specification>
getStartTimeUnchecked :: (MonadDOM m) => PerformanceMarkOptions -> m Double
getStartTimeUnchecked self = liftDOM (((self ^. js "startTime") >>= valToNumber))