packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/RTCErrorEventInit.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.RTCErrorEventInit
       (newRTCErrorEventInit, setError, getError, RTCErrorEventInit(..), gTypeRTCErrorEventInit)
       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-rtcerroreventinit RTCErrorEventInit specification>
newRTCErrorEventInit :: (MonadDOM m) => RTCError -> m RTCErrorEventInit
newRTCErrorEventInit error = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "error" (toJSVal error)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerroreventinit-error RTCErrorEventInit.error specification>
setError :: (MonadDOM m) => RTCErrorEventInit -> RTCError -> m ()
setError self val = liftDOM (void (self ^. jss "error" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerroreventinit-error RTCErrorEventInit.error specification>
getError :: (MonadDOM m) => RTCErrorEventInit -> m RTCError
getError self = liftDOM (((self ^. js "error") >>= fromJSValUnchecked))