ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/InstallEvent.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from service-workers (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.InstallEvent
(js_newInstallEvent, js_addRoutes, newInstallEvent, addRoutes, InstallEvent(..), gTypeInstallEvent)
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 "(($1, $2) => { return new globalThis[\"InstallEvent\"]($1, $2); })"
js_newInstallEvent :: JSString -> JSVal -> IO InstallEvent
-- | <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 (((P.maybe (P.return jsUndefined) toJSVal eventInitDict) >>= \a2' -> js_newInstallEvent (toJSString type') a2'))
foreign import javascript interruptible "(($1, $2, $c) => { return $1[\"addRoutes\"]($2).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
js_addRoutes :: InstallEvent -> RouterRuleOrSequenceRouterRule -> IO (JSVal, ())
-- | <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 (((js_addRoutes (self) (Types.toRouterRuleOrSequenceRouterRule rules)) >>= checkPromiseResult)))