ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/RegistrationOptions.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.RegistrationOptions
(js_newRegistrationOptions, js_setScope, js_getScope, js_setType, js_getType, js_setUpdateViaCache, js_getUpdateViaCache, newRegistrationOptions, setScope, getScope, getScopeUnsafe, getScopeUnchecked, setType, getType, getTypeUnsafe, getTypeUnchecked, setUpdateViaCache, getUpdateViaCache, getUpdateViaCacheUnsafe, getUpdateViaCacheUnchecked, RegistrationOptions(..), gTypeRegistrationOptions)
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_newRegistrationOptions :: IO RegistrationOptions
-- | <https://w3c.github.io/ServiceWorker/#dictdef-registrationoptions RegistrationOptions specification>
newRegistrationOptions :: (MonadDOM m) => m RegistrationOptions
newRegistrationOptions = liftDOM ((js_newRegistrationOptions))
foreign import javascript safe "(($1, $2) => { $1[\"scope\"] = $2; })"
js_setScope :: RegistrationOptions -> JSString -> IO ()
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-scope RegistrationOptions.scope specification>
setScope :: (MonadDOM m, ToJSString val) => RegistrationOptions -> val -> m ()
setScope self val = liftDOM (void ((js_setScope (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"scope\"]; })"
js_getScope :: RegistrationOptions -> IO JSVal
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-scope RegistrationOptions.scope specification>
getScope :: (MonadDOM m, FromJSString result) => RegistrationOptions -> m (Maybe result)
getScope self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getScope (self))))
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-scope RegistrationOptions.scope specification>
getScopeUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => RegistrationOptions -> m result
getScopeUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getScope (self))) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-scope RegistrationOptions.scope specification>
getScopeUnchecked :: (MonadDOM m, FromJSString result) => RegistrationOptions -> m result
getScopeUnchecked self = liftDOM ((pFromJSVal <$> (js_getScope (self))))
foreign import javascript safe "(($1, $2) => { $1[\"type\"] = $2; })"
js_setType :: RegistrationOptions -> JSVal -> IO ()
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-type RegistrationOptions.type specification>
setType :: (MonadDOM m) => RegistrationOptions -> WorkerType -> m ()
setType self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setType (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"type\"]; })"
js_getType :: RegistrationOptions -> IO JSVal
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-type RegistrationOptions.type specification>
getType :: (MonadDOM m) => RegistrationOptions -> m (Maybe WorkerType)
getType self = liftDOM (((js_getType (self)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-type RegistrationOptions.type specification>
getTypeUnsafe :: (MonadDOM m, HasCallStack) => RegistrationOptions -> m WorkerType
getTypeUnsafe self = liftDOM ((((js_getType (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-type RegistrationOptions.type specification>
getTypeUnchecked :: (MonadDOM m) => RegistrationOptions -> m WorkerType
getTypeUnchecked self = liftDOM ((pFromJSVal <$> (js_getType (self))))
foreign import javascript safe "(($1, $2) => { $1[\"updateViaCache\"] = $2; })"
js_setUpdateViaCache :: RegistrationOptions -> JSVal -> IO ()
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-updateviacache RegistrationOptions.updateViaCache specification>
setUpdateViaCache :: (MonadDOM m) => RegistrationOptions -> ServiceWorkerUpdateViaCache -> m ()
setUpdateViaCache self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setUpdateViaCache (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"updateViaCache\"]; })"
js_getUpdateViaCache :: RegistrationOptions -> IO JSVal
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-updateviacache RegistrationOptions.updateViaCache specification>
getUpdateViaCache :: (MonadDOM m) => RegistrationOptions -> m (Maybe ServiceWorkerUpdateViaCache)
getUpdateViaCache self = liftDOM (((js_getUpdateViaCache (self)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-updateviacache RegistrationOptions.updateViaCache specification>
getUpdateViaCacheUnsafe :: (MonadDOM m, HasCallStack) => RegistrationOptions -> m ServiceWorkerUpdateViaCache
getUpdateViaCacheUnsafe self = liftDOM ((((js_getUpdateViaCache (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/ServiceWorker/#dom-registrationoptions-updateviacache RegistrationOptions.updateViaCache specification>
getUpdateViaCacheUnchecked :: (MonadDOM m) => RegistrationOptions -> m ServiceWorkerUpdateViaCache
getUpdateViaCacheUnchecked self = liftDOM ((pFromJSVal <$> (js_getUpdateViaCache (self))))