jsaddle-dom-0.10.0.0: src/JSDOM/Generated/PerformanceNavigation.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from navigation-timing-2 (webref). Do not edit.
module JSDOM.Generated.PerformanceNavigation
(toJSON, toJSON_, getType, getRedirectCount, pattern TYPE_NAVIGATE, pattern TYPE_RELOAD, pattern TYPE_BACK_FORWARD, pattern TYPE_RESERVED, PerformanceNavigation(..), gTypePerformanceNavigation)
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/PerformanceNavigation/toJSON MDN PerformanceNavigation.toJSON documentation>
toJSON :: (MonadDOM m) => PerformanceNavigation -> m GObject
toJSON self = liftDOM (((self ^. jsf "toJSON" ()) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/PerformanceNavigation/toJSON MDN PerformanceNavigation.toJSON documentation>
toJSON_ :: (MonadDOM m) => PerformanceNavigation -> m ()
toJSON_ self = liftDOM (void (self ^. jsf "toJSON" ()))
-- | <https://developer.mozilla.org/docs/Web/API/PerformanceNavigation/type MDN PerformanceNavigation.type documentation>
getType :: (MonadDOM m) => PerformanceNavigation -> m Word
getType self = liftDOM ((P.round <$> ((self ^. js "type") >>= valToNumber)))
-- | <https://developer.mozilla.org/docs/Web/API/PerformanceNavigation/redirectCount MDN PerformanceNavigation.redirectCount documentation>
getRedirectCount :: (MonadDOM m) => PerformanceNavigation -> m Word
getRedirectCount self = liftDOM ((P.round <$> ((self ^. js "redirectCount") >>= valToNumber)))
pattern TYPE_NAVIGATE = 0
pattern TYPE_RELOAD = 1
pattern TYPE_BACK_FORWARD = 2
pattern TYPE_RESERVED = 255