ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/MIDIConnectionEvent.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webmidi (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.MIDIConnectionEvent
(js_newMIDIConnectionEvent, js_getPort, newMIDIConnectionEvent, getPort, getPortUnsafe, getPortUnchecked, MIDIConnectionEvent(..), gTypeMIDIConnectionEvent)
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[\"MIDIConnectionEvent\"]($1, $2); })"
js_newMIDIConnectionEvent :: JSString -> JSVal -> IO MIDIConnectionEvent
-- | <https://developer.mozilla.org/docs/Web/API/MIDIConnectionEvent/MIDIConnectionEvent MDN MIDIConnectionEvent. documentation>
newMIDIConnectionEvent :: (MonadDOM m, ToJSString type') => type' -> Maybe MIDIConnectionEventInit -> m MIDIConnectionEvent
newMIDIConnectionEvent type' eventInitDict = liftDOM (((P.maybe (P.return jsUndefined) toJSVal eventInitDict) >>= \a2' -> js_newMIDIConnectionEvent (toJSString type') a2'))
foreign import javascript unsafe "(($1) => { return $1[\"port\"]; })"
js_getPort :: MIDIConnectionEvent -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/MIDIConnectionEvent/port MDN MIDIConnectionEvent.port documentation>
getPort :: (MonadDOM m) => MIDIConnectionEvent -> m (Maybe MIDIPort)
getPort self = liftDOM (((js_getPort (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/MIDIConnectionEvent/port MDN MIDIConnectionEvent.port documentation>
getPortUnsafe :: (MonadDOM m, HasCallStack) => MIDIConnectionEvent -> m MIDIPort
getPortUnsafe self = liftDOM ((((js_getPort (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/MIDIConnectionEvent/port MDN MIDIConnectionEvent.port documentation>
getPortUnchecked :: (MonadDOM m) => MIDIConnectionEvent -> m MIDIPort
getPortUnchecked self = liftDOM ((pFromJSVal <$> (js_getPort (self))))