jsaddle-dom-0.10.0.0: src/JSDOM/Generated/RTCDataChannelEventInit.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.RTCDataChannelEventInit
(newRTCDataChannelEventInit, setChannel, getChannel, RTCDataChannelEventInit(..), gTypeRTCDataChannelEventInit)
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/webrtc-pc/#dom-rtcdatachanneleventinit RTCDataChannelEventInit specification>
newRTCDataChannelEventInit :: (MonadDOM m) => RTCDataChannel -> m RTCDataChannelEventInit
newRTCDataChannelEventInit channel = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "channel" (toJSVal channel)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachanneleventinit-channel RTCDataChannelEventInit.channel specification>
setChannel :: (MonadDOM m) => RTCDataChannelEventInit -> RTCDataChannel -> m ()
setChannel self val = liftDOM (void (self ^. jss "channel" (toJSVal val)))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachanneleventinit-channel RTCDataChannelEventInit.channel specification>
getChannel :: (MonadDOM m) => RTCDataChannelEventInit -> m RTCDataChannel
getChannel self = liftDOM (((self ^. js "channel") >>= fromJSValUnchecked))