packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from performance-timeline (webref). Do not edit.
module JSDOM.Generated.PerformanceObserverInit
       (newPerformanceObserverInit, setEntryTypes, getEntryTypes, getEntryTypesUnsafe, getEntryTypesUnchecked, setType, getType, getTypeUnsafe, getTypeUnchecked, setBuffered, getBuffered, getBufferedUnsafe, getBufferedUnchecked, setDurationThreshold, getDurationThreshold, getDurationThresholdUnsafe, getDurationThresholdUnchecked, PerformanceObserverInit(..), gTypePerformanceObserverInit)
       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/performance-timeline/#dictdef-performanceobserverinit PerformanceObserverInit specification>
newPerformanceObserverInit :: (MonadDOM m) => m PerformanceObserverInit
newPerformanceObserverInit = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-entrytypes PerformanceObserverInit.entryTypes specification>
setEntryTypes :: (MonadDOM m, ToJSString val) => PerformanceObserverInit -> [val] -> m ()
setEntryTypes self val = liftDOM (void (self ^. jss "entryTypes" (toJSVal val)))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-entrytypes PerformanceObserverInit.entryTypes specification>
getEntryTypes :: (MonadDOM m, FromJSString result) => PerformanceObserverInit -> m (Maybe [result])
getEntryTypes self = liftDOM (((self ^. js "entryTypes") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-entrytypes PerformanceObserverInit.entryTypes specification>
getEntryTypesUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PerformanceObserverInit -> m [result]
getEntryTypesUnsafe self = liftDOM ((((self ^. js "entryTypes") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-entrytypes PerformanceObserverInit.entryTypes specification>
getEntryTypesUnchecked :: (MonadDOM m, FromJSString result) => PerformanceObserverInit -> m [result]
getEntryTypesUnchecked self = liftDOM (((self ^. js "entryTypes") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-type PerformanceObserverInit.type specification>
setType :: (MonadDOM m, ToJSString val) => PerformanceObserverInit -> val -> m ()
setType self val = liftDOM (void (self ^. jss "type" (toJSVal val)))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-type PerformanceObserverInit.type specification>
getType :: (MonadDOM m, FromJSString result) => PerformanceObserverInit -> m (Maybe result)
getType self = liftDOM (((self ^. js "type") >>= fromMaybeJSString))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-type PerformanceObserverInit.type specification>
getTypeUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PerformanceObserverInit -> m result
getTypeUnsafe self = liftDOM ((((self ^. js "type") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-type PerformanceObserverInit.type specification>
getTypeUnchecked :: (MonadDOM m, FromJSString result) => PerformanceObserverInit -> m result
getTypeUnchecked self = liftDOM (((self ^. js "type") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-buffered PerformanceObserverInit.buffered specification>
setBuffered :: (MonadDOM m) => PerformanceObserverInit -> Bool -> m ()
setBuffered self val = liftDOM (void (self ^. jss "buffered" (toJSVal val)))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-buffered PerformanceObserverInit.buffered specification>
getBuffered :: (MonadDOM m) => PerformanceObserverInit -> m (Maybe Bool)
getBuffered self = liftDOM (((self ^. js "buffered") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-buffered PerformanceObserverInit.buffered specification>
getBufferedUnsafe :: (MonadDOM m, HasCallStack) => PerformanceObserverInit -> m Bool
getBufferedUnsafe self = liftDOM ((((self ^. js "buffered") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-buffered PerformanceObserverInit.buffered specification>
getBufferedUnchecked :: (MonadDOM m) => PerformanceObserverInit -> m Bool
getBufferedUnchecked self = liftDOM (((self ^. js "buffered") >>= valToBool))

-- | <https://w3c.github.io/event-timing/#dom-performanceobserverinit-durationthreshold PerformanceObserverInit.durationThreshold specification>
setDurationThreshold :: (MonadDOM m) => PerformanceObserverInit -> Double -> m ()
setDurationThreshold self val = liftDOM (void (self ^. jss "durationThreshold" (toJSVal val)))

-- | <https://w3c.github.io/event-timing/#dom-performanceobserverinit-durationthreshold PerformanceObserverInit.durationThreshold specification>
getDurationThreshold :: (MonadDOM m) => PerformanceObserverInit -> m (Maybe Double)
getDurationThreshold self = liftDOM (((self ^. js "durationThreshold") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/event-timing/#dom-performanceobserverinit-durationthreshold PerformanceObserverInit.durationThreshold specification>
getDurationThresholdUnsafe :: (MonadDOM m, HasCallStack) => PerformanceObserverInit -> m Double
getDurationThresholdUnsafe self = liftDOM ((((self ^. js "durationThreshold") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/event-timing/#dom-performanceobserverinit-durationthreshold PerformanceObserverInit.durationThreshold specification>
getDurationThresholdUnchecked :: (MonadDOM m) => PerformanceObserverInit -> m Double
getDurationThresholdUnchecked self = liftDOM (((self ^. js "durationThreshold") >>= valToNumber))