ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/RTCPeerConnectionIceEvent.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webrtc (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.RTCPeerConnectionIceEvent
(js_newRTCPeerConnectionIceEvent, js_getCandidate, newRTCPeerConnectionIceEvent, getCandidate, getCandidateUnsafe, getCandidateUnchecked, RTCPeerConnectionIceEvent(..), gTypeRTCPeerConnectionIceEvent)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(($1, $2) => { return new globalThis[\"RTCPeerConnectionIceEvent\"]($1, $2); })"
js_newRTCPeerConnectionIceEvent :: JSString -> JSVal -> IO RTCPeerConnectionIceEvent
-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceEvent/RTCPeerConnectionIceEvent MDN RTCPeerConnectionIceEvent. documentation>
newRTCPeerConnectionIceEvent :: (MonadDOM m, ToJSString type') => type' -> Maybe RTCPeerConnectionIceEventInit -> m RTCPeerConnectionIceEvent
newRTCPeerConnectionIceEvent type' eventInitDict = liftDOM (((P.maybe (P.return jsUndefined) toJSVal eventInitDict) >>= \a2' -> js_newRTCPeerConnectionIceEvent (toJSString type') a2'))
foreign import javascript unsafe "(($1) => { return $1[\"candidate\"]; })"
js_getCandidate :: RTCPeerConnectionIceEvent -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceEvent/candidate MDN RTCPeerConnectionIceEvent.candidate documentation>
getCandidate :: (MonadDOM m) => RTCPeerConnectionIceEvent -> m (Maybe RTCIceCandidate)
getCandidate self = liftDOM (((js_getCandidate (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceEvent/candidate MDN RTCPeerConnectionIceEvent.candidate documentation>
getCandidateUnsafe :: (MonadDOM m, HasCallStack) => RTCPeerConnectionIceEvent -> m RTCIceCandidate
getCandidateUnsafe self = liftDOM ((((js_getCandidate (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/RTCPeerConnectionIceEvent/candidate MDN RTCPeerConnectionIceEvent.candidate documentation>
getCandidateUnchecked :: (MonadDOM m) => RTCPeerConnectionIceEvent -> m RTCIceCandidate
getCandidateUnchecked self = liftDOM ((pFromJSVal <$> (js_getCandidate (self))))