jsaddle-dom-0.10.0.0: src/JSDOM/Generated/InstallEvent.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from service-workers (webref). Do not edit.
module JSDOM.Generated.InstallEvent
(newInstallEvent, addRoutes, InstallEvent(..), gTypeInstallEvent)
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://developer.mozilla.org/docs/Web/API/InstallEvent/InstallEvent MDN InstallEvent. documentation>
newInstallEvent :: (MonadDOM m, ToJSString type', IsExtendableEventInit eventInitDict) => type' -> Maybe eventInitDict -> m InstallEvent
newInstallEvent type' eventInitDict = liftDOM (((new (jsg "InstallEvent") [toJSVal type', P.maybe (P.return jsUndefined) toJSVal eventInitDict]) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/InstallEvent/addRoutes MDN InstallEvent.addRoutes documentation>
addRoutes :: (MonadDOM m, IsRouterRuleOrSequenceRouterRule rules) => InstallEvent -> rules -> m ()
addRoutes self rules = liftDOM (void (((self ^. jsf "addRoutes" [toJSVal rules]) >>= readPromise)))