packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/NavigationInterceptOptions.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.NavigationInterceptOptions
       (js_newNavigationInterceptOptions, js_setPrecommitHandler, js_setHandler, js_setFocusReset, js_getFocusReset, js_setScroll, js_getScroll, 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 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_newNavigationInterceptOptions :: IO NavigationInterceptOptions
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationinterceptoptions NavigationInterceptOptions specification>
newNavigationInterceptOptions :: (MonadDOM m) => m NavigationInterceptOptions
newNavigationInterceptOptions = liftDOM ((js_newNavigationInterceptOptions))

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

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

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

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

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

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