packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from wai-aria-1.3 (webref). Do not edit.
module JSDOM.Generated.AriaNotificationOptions
       (newAriaNotificationOptions, setPriority, getPriority, getPriorityUnsafe, getPriorityUnchecked, AriaNotificationOptions(..), gTypeAriaNotificationOptions)
       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/aria/#dom-arianotificationoptions AriaNotificationOptions specification>
newAriaNotificationOptions :: (MonadDOM m) => m AriaNotificationOptions
newAriaNotificationOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/aria/#dom-arianotificationoptions-priority AriaNotificationOptions.priority specification>
setPriority :: (MonadDOM m) => AriaNotificationOptions -> AriaNotifyPriority -> m ()
setPriority self val = liftDOM (void (self ^. jss "priority" (toJSVal val)))

-- | <https://w3c.github.io/aria/#dom-arianotificationoptions-priority AriaNotificationOptions.priority specification>
getPriority :: (MonadDOM m) => AriaNotificationOptions -> m (Maybe AriaNotifyPriority)
getPriority self = liftDOM (((self ^. js "priority") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/aria/#dom-arianotificationoptions-priority AriaNotificationOptions.priority specification>
getPriorityUnsafe :: (MonadDOM m, HasCallStack) => AriaNotificationOptions -> m AriaNotifyPriority
getPriorityUnsafe self = liftDOM ((((self ^. js "priority") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/aria/#dom-arianotificationoptions-priority AriaNotificationOptions.priority specification>
getPriorityUnchecked :: (MonadDOM m) => AriaNotificationOptions -> m AriaNotifyPriority
getPriorityUnchecked self = liftDOM (((self ^. js "priority") >>= fromJSValUnchecked))