jsaddle-dom-0.10.0.0: src/JSDOM/Generated/ClientQueryOptions.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.ClientQueryOptions
(newClientQueryOptions, setIncludeUncontrolled, getIncludeUncontrolled, getIncludeUncontrolledUnsafe, getIncludeUncontrolledUnchecked, setType, getType, getTypeUnsafe, getTypeUnchecked, ClientQueryOptions(..), gTypeClientQueryOptions)
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-clientqueryoptions ClientQueryOptions specification>
newClientQueryOptions :: (MonadDOM m) => m ClientQueryOptions
newClientQueryOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/ServiceWorker/#dom-clientqueryoptions-includeuncontrolled ClientQueryOptions.includeUncontrolled specification>
setIncludeUncontrolled :: (MonadDOM m) => ClientQueryOptions -> Bool -> m ()
setIncludeUncontrolled self val = liftDOM (void (self ^. jss "includeUncontrolled" (toJSVal val)))
-- | <https://w3c.github.io/ServiceWorker/#dom-clientqueryoptions-includeuncontrolled ClientQueryOptions.includeUncontrolled specification>
getIncludeUncontrolled :: (MonadDOM m) => ClientQueryOptions -> m (Maybe Bool)
getIncludeUncontrolled self = liftDOM (((self ^. js "includeUncontrolled") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/ServiceWorker/#dom-clientqueryoptions-includeuncontrolled ClientQueryOptions.includeUncontrolled specification>
getIncludeUncontrolledUnsafe :: (MonadDOM m, HasCallStack) => ClientQueryOptions -> m Bool
getIncludeUncontrolledUnsafe self = liftDOM ((((self ^. js "includeUncontrolled") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/ServiceWorker/#dom-clientqueryoptions-includeuncontrolled ClientQueryOptions.includeUncontrolled specification>
getIncludeUncontrolledUnchecked :: (MonadDOM m) => ClientQueryOptions -> m Bool
getIncludeUncontrolledUnchecked self = liftDOM (((self ^. js "includeUncontrolled") >>= valToBool))
-- | <https://w3c.github.io/ServiceWorker/#dom-clientqueryoptions-type ClientQueryOptions.type specification>
setType :: (MonadDOM m) => ClientQueryOptions -> ClientType -> m ()
setType self val = liftDOM (void (self ^. jss "type" (toJSVal val)))
-- | <https://w3c.github.io/ServiceWorker/#dom-clientqueryoptions-type ClientQueryOptions.type specification>
getType :: (MonadDOM m) => ClientQueryOptions -> m (Maybe ClientType)
getType self = liftDOM (((self ^. js "type") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/ServiceWorker/#dom-clientqueryoptions-type ClientQueryOptions.type specification>
getTypeUnsafe :: (MonadDOM m, HasCallStack) => ClientQueryOptions -> m ClientType
getTypeUnsafe self = liftDOM ((((self ^. js "type") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/ServiceWorker/#dom-clientqueryoptions-type ClientQueryOptions.type specification>
getTypeUnchecked :: (MonadDOM m) => ClientQueryOptions -> m ClientType
getTypeUnchecked self = liftDOM (((self ^. js "type") >>= fromJSValUnchecked))