packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/RouterSourceDict.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.RouterSourceDict
       (newRouterSourceDict, setCacheName, getCacheName, getCacheNameUnsafe, getCacheNameUnchecked, RouterSourceDict(..), gTypeRouterSourceDict)
       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://w3c.github.io/ServiceWorker/#dictdef-routersourcedict RouterSourceDict specification>
newRouterSourceDict :: (MonadDOM m) => m RouterSourceDict
newRouterSourceDict = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/ServiceWorker/#dom-routersourcedict-cachename RouterSourceDict.cacheName specification>
setCacheName :: (MonadDOM m, ToJSString val) => RouterSourceDict -> val -> m ()
setCacheName self val = liftDOM (void (self ^. jss "cacheName" (toJSVal val)))

-- | <https://w3c.github.io/ServiceWorker/#dom-routersourcedict-cachename RouterSourceDict.cacheName specification>
getCacheName :: (MonadDOM m, FromJSString result) => RouterSourceDict -> m (Maybe result)
getCacheName self = liftDOM (((self ^. js "cacheName") >>= fromMaybeJSString))

-- | <https://w3c.github.io/ServiceWorker/#dom-routersourcedict-cachename RouterSourceDict.cacheName specification>
getCacheNameUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => RouterSourceDict -> m result
getCacheNameUnsafe self = liftDOM ((((self ^. js "cacheName") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/ServiceWorker/#dom-routersourcedict-cachename RouterSourceDict.cacheName specification>
getCacheNameUnchecked :: (MonadDOM m, FromJSString result) => RouterSourceDict -> m result
getCacheNameUnchecked self = liftDOM (((self ^. js "cacheName") >>= fromJSValUnchecked))