packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.NavigationResult
       (js_newNavigationResult, js_setCommitted, js_getCommitted, js_setFinished, js_getFinished, 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 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 "(() => { return ({}); })"
        js_newNavigationResult :: IO NavigationResult
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationresult NavigationResult specification>
newNavigationResult :: (MonadDOM m) => m NavigationResult
newNavigationResult = liftDOM ((js_newNavigationResult))

foreign import javascript safe "(($1, $2) => { $1[\"committed\"] = $2; })"
        js_setCommitted :: NavigationResult -> JSVal -> IO ()
-- | <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 (((toJSVal val) >>= \a2' -> js_setCommitted (self) a2')))

foreign import javascript unsafe "(($1) => { return $1[\"committed\"]; })"
        js_getCommitted :: NavigationResult -> IO JSVal
-- | <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 (((js_getCommitted (self)) >>= 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 ((((js_getCommitted (self)) >>= 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 ((pFromJSVal <$> (js_getCommitted (self))))

foreign import javascript safe "(($1, $2) => { $1[\"finished\"] = $2; })"
        js_setFinished :: NavigationResult -> JSVal -> IO ()
-- | <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 (((toJSVal val) >>= \a2' -> js_setFinished (self) a2')))

foreign import javascript unsafe "(($1) => { return $1[\"finished\"]; })"
        js_getFinished :: NavigationResult -> IO JSVal
-- | <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 (((js_getFinished (self)) >>= 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 ((((js_getFinished (self)) >>= 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 ((pFromJSVal <$> (js_getFinished (self))))