packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module JSDOM.Generated.NavigationResult
       (newNavigationResult, setCommitted, getCommitted, getCommittedUnsafe, getCommittedUnchecked, setFinished, getFinished, getFinishedUnsafe, getFinishedUnchecked, NavigationResult(..), gTypeNavigationResult)
       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://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationresult NavigationResult specification>
newNavigationResult :: (MonadDOM m) => m NavigationResult
newNavigationResult = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationresult-committed NavigationResult.committed specification>
setCommitted :: (MonadDOM m) => NavigationResult -> JSVal -> m ()
setCommitted self val = liftDOM (void (self ^. jss "committed" (toJSVal val)))

-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationresult-committed NavigationResult.committed specification>
getCommitted :: (MonadDOM m) => NavigationResult -> m (Maybe NavigationHistoryEntry)
getCommitted self = liftDOM (((self ^. js "committed") >>= fromJSValUnchecked))

-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationresult-committed NavigationResult.committed specification>
getCommittedUnsafe :: (MonadDOM m, HasCallStack) => NavigationResult -> m NavigationHistoryEntry
getCommittedUnsafe self = liftDOM ((((self ^. js "committed") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationresult-committed NavigationResult.committed specification>
getCommittedUnchecked :: (MonadDOM m) => NavigationResult -> m NavigationHistoryEntry
getCommittedUnchecked self = liftDOM (((self ^. js "committed") >>= fromJSValUnchecked))

-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationresult-finished NavigationResult.finished specification>
setFinished :: (MonadDOM m) => NavigationResult -> JSVal -> m ()
setFinished self val = liftDOM (void (self ^. jss "finished" (toJSVal val)))

-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationresult-finished NavigationResult.finished specification>
getFinished :: (MonadDOM m) => NavigationResult -> m (Maybe NavigationHistoryEntry)
getFinished self = liftDOM (((self ^. js "finished") >>= fromJSValUnchecked))

-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationresult-finished NavigationResult.finished specification>
getFinishedUnsafe :: (MonadDOM m, HasCallStack) => NavigationResult -> m NavigationHistoryEntry
getFinishedUnsafe self = liftDOM ((((self ^. js "finished") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationresult-finished NavigationResult.finished specification>
getFinishedUnchecked :: (MonadDOM m) => NavigationResult -> m NavigationHistoryEntry
getFinishedUnchecked self = liftDOM (((self ^. js "finished") >>= fromJSValUnchecked))