jsaddle-dom-0.10.0.0: src/JSDOM/Generated/PromiseRejectionEvent.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module JSDOM.Generated.PromiseRejectionEvent
(newPromiseRejectionEvent, getPromise, getReason, PromiseRejectionEvent(..), gTypePromiseRejectionEvent)
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/PromiseRejectionEvent/PromiseRejectionEvent MDN PromiseRejectionEvent. documentation>
newPromiseRejectionEvent :: (MonadDOM m, ToJSString type') => type' -> PromiseRejectionEventInit -> m PromiseRejectionEvent
newPromiseRejectionEvent type' eventInitDict = liftDOM (((new (jsg "PromiseRejectionEvent") [toJSVal type', toJSVal eventInitDict]) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise MDN PromiseRejectionEvent.promise documentation>
getPromise :: (MonadDOM m) => PromiseRejectionEvent -> m GObject
getPromise self = liftDOM (((self ^. js "promise") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason MDN PromiseRejectionEvent.reason documentation>
getReason :: (MonadDOM m) => PromiseRejectionEvent -> m JSVal
getReason self = liftDOM (self ^. js "reason")