jsaddle-dom-0.10.0.0: src/JSDOM/Generated/PushSubscriptionOptions.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from push-api (webref). Do not edit.
module JSDOM.Generated.PushSubscriptionOptions
(getUserVisibleOnly, getApplicationServerKey, getApplicationServerKeyUnsafe, getApplicationServerKeyUnchecked, PushSubscriptionOptions(..), gTypePushSubscriptionOptions)
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/PushSubscriptionOptions/userVisibleOnly MDN PushSubscriptionOptions.userVisibleOnly documentation>
getUserVisibleOnly :: (MonadDOM m) => PushSubscriptionOptions -> m Bool
getUserVisibleOnly self = liftDOM (((self ^. js "userVisibleOnly") >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/PushSubscriptionOptions/applicationServerKey MDN PushSubscriptionOptions.applicationServerKey documentation>
getApplicationServerKey :: (MonadDOM m) => PushSubscriptionOptions -> m (Maybe ArrayBuffer)
getApplicationServerKey self = liftDOM (((self ^. js "applicationServerKey") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/PushSubscriptionOptions/applicationServerKey MDN PushSubscriptionOptions.applicationServerKey documentation>
getApplicationServerKeyUnsafe :: (MonadDOM m, HasCallStack) => PushSubscriptionOptions -> m ArrayBuffer
getApplicationServerKeyUnsafe self = liftDOM ((((self ^. js "applicationServerKey") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/PushSubscriptionOptions/applicationServerKey MDN PushSubscriptionOptions.applicationServerKey documentation>
getApplicationServerKeyUnchecked :: (MonadDOM m) => PushSubscriptionOptions -> m ArrayBuffer
getApplicationServerKeyUnchecked self = liftDOM (((self ^. js "applicationServerKey") >>= fromJSValUnchecked))