packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webrtc (webref). Do not edit.
module JSDOM.Generated.RTCPeerConnectionIceErrorEvent
       (newRTCPeerConnectionIceErrorEvent, getAddress, getAddressUnsafe, getAddressUnchecked, getPort, getPortUnsafe, getPortUnchecked, getUrl, getErrorCode, getErrorText, RTCPeerConnectionIceErrorEvent(..), gTypeRTCPeerConnectionIceErrorEvent)
       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/RTCPeerConnectionIceErrorEvent/RTCPeerConnectionIceErrorEvent MDN RTCPeerConnectionIceErrorEvent. documentation>
newRTCPeerConnectionIceErrorEvent :: (MonadDOM m, ToJSString type') => type' -> RTCPeerConnectionIceErrorEventInit -> m RTCPeerConnectionIceErrorEvent
newRTCPeerConnectionIceErrorEvent type' eventInitDict = liftDOM (((new (jsg "RTCPeerConnectionIceErrorEvent") [toJSVal type', toJSVal eventInitDict]) >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/address MDN RTCPeerConnectionIceErrorEvent.address documentation>
getAddress :: (MonadDOM m, FromJSString result) => RTCPeerConnectionIceErrorEvent -> m (Maybe result)
getAddress self = liftDOM (((self ^. js "address") >>= fromMaybeJSString))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/address MDN RTCPeerConnectionIceErrorEvent.address documentation>
getAddressUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => RTCPeerConnectionIceErrorEvent -> m result
getAddressUnsafe self = liftDOM ((((self ^. js "address") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/address MDN RTCPeerConnectionIceErrorEvent.address documentation>
getAddressUnchecked :: (MonadDOM m, FromJSString result) => RTCPeerConnectionIceErrorEvent -> m result
getAddressUnchecked self = liftDOM (((self ^. js "address") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/port MDN RTCPeerConnectionIceErrorEvent.port documentation>
getPort :: (MonadDOM m) => RTCPeerConnectionIceErrorEvent -> m (Maybe Word)
getPort self = liftDOM (((self ^. js "port") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/port MDN RTCPeerConnectionIceErrorEvent.port documentation>
getPortUnsafe :: (MonadDOM m, HasCallStack) => RTCPeerConnectionIceErrorEvent -> m Word
getPortUnsafe self = liftDOM ((((self ^. js "port") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/port MDN RTCPeerConnectionIceErrorEvent.port documentation>
getPortUnchecked :: (MonadDOM m) => RTCPeerConnectionIceErrorEvent -> m Word
getPortUnchecked self = liftDOM ((P.round <$> ((self ^. js "port") >>= valToNumber)))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/url MDN RTCPeerConnectionIceErrorEvent.url documentation>
getUrl :: (MonadDOM m, FromJSString result) => RTCPeerConnectionIceErrorEvent -> m result
getUrl self = liftDOM (((self ^. js "url") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/errorCode MDN RTCPeerConnectionIceErrorEvent.errorCode documentation>
getErrorCode :: (MonadDOM m) => RTCPeerConnectionIceErrorEvent -> m Word
getErrorCode self = liftDOM ((P.round <$> ((self ^. js "errorCode") >>= valToNumber)))

-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceErrorEvent/errorText MDN RTCPeerConnectionIceErrorEvent.errorText documentation>
getErrorText :: (MonadDOM m, FromJSString result) => RTCPeerConnectionIceErrorEvent -> m result
getErrorText self = liftDOM (((self ^. js "errorText") >>= fromJSValUnchecked))