jsaddle-dom-0.10.0.0: src/JSDOM/Generated/NavigationInterceptOptions.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.NavigationInterceptOptions
(newNavigationInterceptOptions, setPrecommitHandler, setHandler, setFocusReset, getFocusReset, getFocusResetUnsafe, getFocusResetUnchecked, setScroll, getScroll, getScrollUnsafe, getScrollUnchecked, NavigationInterceptOptions(..), gTypeNavigationInterceptOptions)
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#navigationinterceptoptions NavigationInterceptOptions specification>
newNavigationInterceptOptions :: (MonadDOM m) => m NavigationInterceptOptions
newNavigationInterceptOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-precommithandler NavigationInterceptOptions.precommitHandler specification>
setPrecommitHandler :: (MonadDOM m) => NavigationInterceptOptions -> NavigationPrecommitHandler -> m ()
setPrecommitHandler self val = liftDOM (void (self ^. jss "precommitHandler" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-handler NavigationInterceptOptions.handler specification>
setHandler :: (MonadDOM m) => NavigationInterceptOptions -> NavigationInterceptHandler -> m ()
setHandler self val = liftDOM (void (self ^. jss "handler" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-focusreset NavigationInterceptOptions.focusReset specification>
setFocusReset :: (MonadDOM m) => NavigationInterceptOptions -> NavigationFocusReset -> m ()
setFocusReset self val = liftDOM (void (self ^. jss "focusReset" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-focusreset NavigationInterceptOptions.focusReset specification>
getFocusReset :: (MonadDOM m) => NavigationInterceptOptions -> m (Maybe NavigationFocusReset)
getFocusReset self = liftDOM (((self ^. js "focusReset") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-focusreset NavigationInterceptOptions.focusReset specification>
getFocusResetUnsafe :: (MonadDOM m, HasCallStack) => NavigationInterceptOptions -> m NavigationFocusReset
getFocusResetUnsafe self = liftDOM ((((self ^. js "focusReset") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-focusreset NavigationInterceptOptions.focusReset specification>
getFocusResetUnchecked :: (MonadDOM m) => NavigationInterceptOptions -> m NavigationFocusReset
getFocusResetUnchecked self = liftDOM (((self ^. js "focusReset") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-scroll NavigationInterceptOptions.scroll specification>
setScroll :: (MonadDOM m) => NavigationInterceptOptions -> NavigationScrollBehavior -> m ()
setScroll self val = liftDOM (void (self ^. jss "scroll" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-scroll NavigationInterceptOptions.scroll specification>
getScroll :: (MonadDOM m) => NavigationInterceptOptions -> m (Maybe NavigationScrollBehavior)
getScroll self = liftDOM (((self ^. js "scroll") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-scroll NavigationInterceptOptions.scroll specification>
getScrollUnsafe :: (MonadDOM m, HasCallStack) => NavigationInterceptOptions -> m NavigationScrollBehavior
getScrollUnsafe self = liftDOM ((((self ^. js "scroll") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationinterceptoptions-scroll NavigationInterceptOptions.scroll specification>
getScrollUnchecked :: (MonadDOM m) => NavigationInterceptOptions -> m NavigationScrollBehavior
getScrollUnchecked self = liftDOM (((self ^. js "scroll") >>= fromJSValUnchecked))