jsaddle-dom-0.10.0.0: src/JSDOM/Generated/NavigationCurrentEntryChangeEventInit.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.NavigationCurrentEntryChangeEventInit
(newNavigationCurrentEntryChangeEventInit, setNavigationType, getNavigationType, getNavigationTypeUnsafe, getNavigationTypeUnchecked, setFrom, getFrom, NavigationCurrentEntryChangeEventInit(..), gTypeNavigationCurrentEntryChangeEventInit)
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#navigationcurrententrychangeeventinit NavigationCurrentEntryChangeEventInit specification>
newNavigationCurrentEntryChangeEventInit :: (MonadDOM m) => NavigationHistoryEntry -> m NavigationCurrentEntryChangeEventInit
newNavigationCurrentEntryChangeEventInit from = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "from" (toJSVal from)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationcurrententrychangeeventinit-navigationtype NavigationCurrentEntryChangeEventInit.navigationType specification>
setNavigationType :: (MonadDOM m) => NavigationCurrentEntryChangeEventInit -> Maybe NavigationType -> m ()
setNavigationType self val = liftDOM (void (self ^. jss "navigationType" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationcurrententrychangeeventinit-navigationtype NavigationCurrentEntryChangeEventInit.navigationType specification>
getNavigationType :: (MonadDOM m) => NavigationCurrentEntryChangeEventInit -> m (Maybe NavigationType)
getNavigationType self = liftDOM (((self ^. js "navigationType") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationcurrententrychangeeventinit-navigationtype NavigationCurrentEntryChangeEventInit.navigationType specification>
getNavigationTypeUnsafe :: (MonadDOM m, HasCallStack) => NavigationCurrentEntryChangeEventInit -> m NavigationType
getNavigationTypeUnsafe self = liftDOM ((((self ^. js "navigationType") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationcurrententrychangeeventinit-navigationtype NavigationCurrentEntryChangeEventInit.navigationType specification>
getNavigationTypeUnchecked :: (MonadDOM m) => NavigationCurrentEntryChangeEventInit -> m NavigationType
getNavigationTypeUnchecked self = liftDOM (((self ^. js "navigationType") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationcurrententrychangeeventinit-from NavigationCurrentEntryChangeEventInit.from specification>
setFrom :: (MonadDOM m) => NavigationCurrentEntryChangeEventInit -> NavigationHistoryEntry -> m ()
setFrom self val = liftDOM (void (self ^. jss "from" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationcurrententrychangeeventinit-from NavigationCurrentEntryChangeEventInit.from specification>
getFrom :: (MonadDOM m) => NavigationCurrentEntryChangeEventInit -> m NavigationHistoryEntry
getFrom self = liftDOM (((self ^. js "from") >>= fromJSValUnchecked))