packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/NotificationOptions.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from notifications (webref). Do not edit.
module JSDOM.Generated.NotificationOptions
       (newNotificationOptions, setDir, getDir, getDirUnsafe, getDirUnchecked, setLang, getLang, getLangUnsafe, getLangUnchecked, setBody, getBody, getBodyUnsafe, getBodyUnchecked, setNavigate, getNavigate, getNavigateUnsafe, getNavigateUnchecked, setTag, getTag, getTagUnsafe, getTagUnchecked, setImage, getImage, getImageUnsafe, getImageUnchecked, setIcon, getIcon, getIconUnsafe, getIconUnchecked, setBadge, getBadge, getBadgeUnsafe, getBadgeUnchecked, setTimestamp, getTimestamp, getTimestampUnsafe, getTimestampUnchecked, setRenotify, getRenotify, getRenotifyUnsafe, getRenotifyUnchecked, setSilent, getSilent, getSilentUnsafe, getSilentUnchecked, setRequireInteraction, getRequireInteraction, getRequireInteractionUnsafe, getRequireInteractionUnchecked, setData, getData, setActions, getActions, getActionsUnsafe, getActionsUnchecked, NotificationOptions(..), gTypeNotificationOptions)
       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://notifications.spec.whatwg.org/#dictdef-notificationoptions NotificationOptions specification>
newNotificationOptions :: (MonadDOM m) => m NotificationOptions
newNotificationOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-dir NotificationOptions.dir specification>
setDir :: (MonadDOM m) => NotificationOptions -> NotificationDirection -> m ()
setDir self val = liftDOM (void (self ^. jss "dir" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-dir NotificationOptions.dir specification>
getDir :: (MonadDOM m) => NotificationOptions -> m (Maybe NotificationDirection)
getDir self = liftDOM (((self ^. js "dir") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-dir NotificationOptions.dir specification>
getDirUnsafe :: (MonadDOM m, HasCallStack) => NotificationOptions -> m NotificationDirection
getDirUnsafe self = liftDOM ((((self ^. js "dir") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-dir NotificationOptions.dir specification>
getDirUnchecked :: (MonadDOM m) => NotificationOptions -> m NotificationDirection
getDirUnchecked self = liftDOM (((self ^. js "dir") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-lang NotificationOptions.lang specification>
setLang :: (MonadDOM m, ToJSString val) => NotificationOptions -> val -> m ()
setLang self val = liftDOM (void (self ^. jss "lang" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-lang NotificationOptions.lang specification>
getLang :: (MonadDOM m, FromJSString result) => NotificationOptions -> m (Maybe result)
getLang self = liftDOM (((self ^. js "lang") >>= fromMaybeJSString))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-lang NotificationOptions.lang specification>
getLangUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => NotificationOptions -> m result
getLangUnsafe self = liftDOM ((((self ^. js "lang") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-lang NotificationOptions.lang specification>
getLangUnchecked :: (MonadDOM m, FromJSString result) => NotificationOptions -> m result
getLangUnchecked self = liftDOM (((self ^. js "lang") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-body NotificationOptions.body specification>
setBody :: (MonadDOM m, ToJSString val) => NotificationOptions -> val -> m ()
setBody self val = liftDOM (void (self ^. jss "body" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-body NotificationOptions.body specification>
getBody :: (MonadDOM m, FromJSString result) => NotificationOptions -> m (Maybe result)
getBody self = liftDOM (((self ^. js "body") >>= fromMaybeJSString))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-body NotificationOptions.body specification>
getBodyUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => NotificationOptions -> m result
getBodyUnsafe self = liftDOM ((((self ^. js "body") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-body NotificationOptions.body specification>
getBodyUnchecked :: (MonadDOM m, FromJSString result) => NotificationOptions -> m result
getBodyUnchecked self = liftDOM (((self ^. js "body") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-navigate NotificationOptions.navigate specification>
setNavigate :: (MonadDOM m, ToJSString val) => NotificationOptions -> val -> m ()
setNavigate self val = liftDOM (void (self ^. jss "navigate" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-navigate NotificationOptions.navigate specification>
getNavigate :: (MonadDOM m, FromJSString result) => NotificationOptions -> m (Maybe result)
getNavigate self = liftDOM (((self ^. js "navigate") >>= fromMaybeJSString))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-navigate NotificationOptions.navigate specification>
getNavigateUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => NotificationOptions -> m result
getNavigateUnsafe self = liftDOM ((((self ^. js "navigate") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-navigate NotificationOptions.navigate specification>
getNavigateUnchecked :: (MonadDOM m, FromJSString result) => NotificationOptions -> m result
getNavigateUnchecked self = liftDOM (((self ^. js "navigate") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-tag NotificationOptions.tag specification>
setTag :: (MonadDOM m, ToJSString val) => NotificationOptions -> val -> m ()
setTag self val = liftDOM (void (self ^. jss "tag" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-tag NotificationOptions.tag specification>
getTag :: (MonadDOM m, FromJSString result) => NotificationOptions -> m (Maybe result)
getTag self = liftDOM (((self ^. js "tag") >>= fromMaybeJSString))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-tag NotificationOptions.tag specification>
getTagUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => NotificationOptions -> m result
getTagUnsafe self = liftDOM ((((self ^. js "tag") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-tag NotificationOptions.tag specification>
getTagUnchecked :: (MonadDOM m, FromJSString result) => NotificationOptions -> m result
getTagUnchecked self = liftDOM (((self ^. js "tag") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-image NotificationOptions.image specification>
setImage :: (MonadDOM m, ToJSString val) => NotificationOptions -> val -> m ()
setImage self val = liftDOM (void (self ^. jss "image" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-image NotificationOptions.image specification>
getImage :: (MonadDOM m, FromJSString result) => NotificationOptions -> m (Maybe result)
getImage self = liftDOM (((self ^. js "image") >>= fromMaybeJSString))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-image NotificationOptions.image specification>
getImageUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => NotificationOptions -> m result
getImageUnsafe self = liftDOM ((((self ^. js "image") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-image NotificationOptions.image specification>
getImageUnchecked :: (MonadDOM m, FromJSString result) => NotificationOptions -> m result
getImageUnchecked self = liftDOM (((self ^. js "image") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-icon NotificationOptions.icon specification>
setIcon :: (MonadDOM m, ToJSString val) => NotificationOptions -> val -> m ()
setIcon self val = liftDOM (void (self ^. jss "icon" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-icon NotificationOptions.icon specification>
getIcon :: (MonadDOM m, FromJSString result) => NotificationOptions -> m (Maybe result)
getIcon self = liftDOM (((self ^. js "icon") >>= fromMaybeJSString))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-icon NotificationOptions.icon specification>
getIconUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => NotificationOptions -> m result
getIconUnsafe self = liftDOM ((((self ^. js "icon") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-icon NotificationOptions.icon specification>
getIconUnchecked :: (MonadDOM m, FromJSString result) => NotificationOptions -> m result
getIconUnchecked self = liftDOM (((self ^. js "icon") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-badge NotificationOptions.badge specification>
setBadge :: (MonadDOM m, ToJSString val) => NotificationOptions -> val -> m ()
setBadge self val = liftDOM (void (self ^. jss "badge" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-badge NotificationOptions.badge specification>
getBadge :: (MonadDOM m, FromJSString result) => NotificationOptions -> m (Maybe result)
getBadge self = liftDOM (((self ^. js "badge") >>= fromMaybeJSString))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-badge NotificationOptions.badge specification>
getBadgeUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => NotificationOptions -> m result
getBadgeUnsafe self = liftDOM ((((self ^. js "badge") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-badge NotificationOptions.badge specification>
getBadgeUnchecked :: (MonadDOM m, FromJSString result) => NotificationOptions -> m result
getBadgeUnchecked self = liftDOM (((self ^. js "badge") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-timestamp NotificationOptions.timestamp specification>
setTimestamp :: (MonadDOM m) => NotificationOptions -> Word53 -> m ()
setTimestamp self val = liftDOM (void (self ^. jss "timestamp" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-timestamp NotificationOptions.timestamp specification>
getTimestamp :: (MonadDOM m) => NotificationOptions -> m (Maybe Word53)
getTimestamp self = liftDOM (((self ^. js "timestamp") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-timestamp NotificationOptions.timestamp specification>
getTimestampUnsafe :: (MonadDOM m, HasCallStack) => NotificationOptions -> m Word53
getTimestampUnsafe self = liftDOM ((((self ^. js "timestamp") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-timestamp NotificationOptions.timestamp specification>
getTimestampUnchecked :: (MonadDOM m) => NotificationOptions -> m Word53
getTimestampUnchecked self = liftDOM (((self ^. js "timestamp") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-renotify NotificationOptions.renotify specification>
setRenotify :: (MonadDOM m) => NotificationOptions -> Bool -> m ()
setRenotify self val = liftDOM (void (self ^. jss "renotify" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-renotify NotificationOptions.renotify specification>
getRenotify :: (MonadDOM m) => NotificationOptions -> m (Maybe Bool)
getRenotify self = liftDOM (((self ^. js "renotify") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-renotify NotificationOptions.renotify specification>
getRenotifyUnsafe :: (MonadDOM m, HasCallStack) => NotificationOptions -> m Bool
getRenotifyUnsafe self = liftDOM ((((self ^. js "renotify") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-renotify NotificationOptions.renotify specification>
getRenotifyUnchecked :: (MonadDOM m) => NotificationOptions -> m Bool
getRenotifyUnchecked self = liftDOM (((self ^. js "renotify") >>= valToBool))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-silent NotificationOptions.silent specification>
setSilent :: (MonadDOM m) => NotificationOptions -> Maybe Bool -> m ()
setSilent self val = liftDOM (void (self ^. jss "silent" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-silent NotificationOptions.silent specification>
getSilent :: (MonadDOM m) => NotificationOptions -> m (Maybe Bool)
getSilent self = liftDOM (((self ^. js "silent") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-silent NotificationOptions.silent specification>
getSilentUnsafe :: (MonadDOM m, HasCallStack) => NotificationOptions -> m Bool
getSilentUnsafe self = liftDOM ((((self ^. js "silent") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-silent NotificationOptions.silent specification>
getSilentUnchecked :: (MonadDOM m) => NotificationOptions -> m Bool
getSilentUnchecked self = liftDOM (((self ^. js "silent") >>= valToBool))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-requireinteraction NotificationOptions.requireInteraction specification>
setRequireInteraction :: (MonadDOM m) => NotificationOptions -> Bool -> m ()
setRequireInteraction self val = liftDOM (void (self ^. jss "requireInteraction" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-requireinteraction NotificationOptions.requireInteraction specification>
getRequireInteraction :: (MonadDOM m) => NotificationOptions -> m (Maybe Bool)
getRequireInteraction self = liftDOM (((self ^. js "requireInteraction") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-requireinteraction NotificationOptions.requireInteraction specification>
getRequireInteractionUnsafe :: (MonadDOM m, HasCallStack) => NotificationOptions -> m Bool
getRequireInteractionUnsafe self = liftDOM ((((self ^. js "requireInteraction") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-requireinteraction NotificationOptions.requireInteraction specification>
getRequireInteractionUnchecked :: (MonadDOM m) => NotificationOptions -> m Bool
getRequireInteractionUnchecked self = liftDOM (((self ^. js "requireInteraction") >>= valToBool))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-data NotificationOptions.data specification>
setData :: (MonadDOM m) => NotificationOptions -> JSVal -> m ()
setData self val = liftDOM (void (self ^. jss "data" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-data NotificationOptions.data specification>
getData :: (MonadDOM m) => NotificationOptions -> m JSVal
getData self = liftDOM (self ^. js "data")

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-actions NotificationOptions.actions specification>
setActions :: (MonadDOM m) => NotificationOptions -> [NotificationAction] -> m ()
setActions self val = liftDOM (void (self ^. jss "actions" (toJSVal val)))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-actions NotificationOptions.actions specification>
getActions :: (MonadDOM m) => NotificationOptions -> m (Maybe [NotificationAction])
getActions self = liftDOM (((self ^. js "actions") >>= fromJSValUnchecked))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-actions NotificationOptions.actions specification>
getActionsUnsafe :: (MonadDOM m, HasCallStack) => NotificationOptions -> m [NotificationAction]
getActionsUnsafe self = liftDOM ((((self ^. js "actions") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://notifications.spec.whatwg.org/#dom-notificationoptions-actions NotificationOptions.actions specification>
getActionsUnchecked :: (MonadDOM m) => NotificationOptions -> m [NotificationAction]
getActionsUnchecked self = liftDOM (((self ^. js "actions") >>= fromJSValUnchecked))