jsaddle-dom-0.10.0.0: src/JSDOM/Generated/NotificationEvent.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.NotificationEvent
(newNotificationEvent, getNotification, getAction, NotificationEvent(..), gTypeNotificationEvent)
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/NotificationEvent/NotificationEvent MDN NotificationEvent. documentation>
newNotificationEvent :: (MonadDOM m, ToJSString type') => type' -> NotificationEventInit -> m NotificationEvent
newNotificationEvent type' eventInitDict = liftDOM (((new (jsg "NotificationEvent") [toJSVal type', toJSVal eventInitDict]) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/NotificationEvent/notification MDN NotificationEvent.notification documentation>
getNotification :: (MonadDOM m) => NotificationEvent -> m Notification
getNotification self = liftDOM (((self ^. js "notification") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/NotificationEvent/action MDN NotificationEvent.action documentation>
getAction :: (MonadDOM m, FromJSString result) => NotificationEvent -> m result
getAction self = liftDOM (((self ^. js "action") >>= fromJSValUnchecked))