packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/MIDIConnectionEventInit.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.MIDIConnectionEventInit
       (js_newMIDIConnectionEventInit, js_setPort, js_getPort, newMIDIConnectionEventInit, setPort, getPort, getPortUnsafe, getPortUnchecked, MIDIConnectionEventInit(..), gTypeMIDIConnectionEventInit)
       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 "(() => { return ({}); })"
        js_newMIDIConnectionEventInit :: IO MIDIConnectionEventInit
-- | <https://webaudio.github.io/web-midi-api/#dom-midiconnectioneventinit MIDIConnectionEventInit specification>
newMIDIConnectionEventInit :: (MonadDOM m) => m MIDIConnectionEventInit
newMIDIConnectionEventInit = liftDOM ((js_newMIDIConnectionEventInit))

foreign import javascript safe "(($1, $2) => { $1[\"port\"] = $2; })"
        js_setPort :: MIDIConnectionEventInit -> MIDIPort -> IO ()
-- | <https://webaudio.github.io/web-midi-api/#dom-midiconnectioneventinit-port MIDIConnectionEventInit.port specification>
setPort :: (MonadDOM m, IsMIDIPort val) => MIDIConnectionEventInit -> val -> m ()
setPort self val = liftDOM (void ((js_setPort (self) (Types.toMIDIPort val))))

foreign import javascript unsafe "(($1) => { return $1[\"port\"]; })"
        js_getPort :: MIDIConnectionEventInit -> IO JSVal
-- | <https://webaudio.github.io/web-midi-api/#dom-midiconnectioneventinit-port MIDIConnectionEventInit.port specification>
getPort :: (MonadDOM m) => MIDIConnectionEventInit -> m (Maybe MIDIPort)
getPort self = liftDOM (((js_getPort (self)) >>= fromJSValUnchecked))

-- | <https://webaudio.github.io/web-midi-api/#dom-midiconnectioneventinit-port MIDIConnectionEventInit.port specification>
getPortUnsafe :: (MonadDOM m, HasCallStack) => MIDIConnectionEventInit -> m MIDIPort
getPortUnsafe self = liftDOM ((((js_getPort (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://webaudio.github.io/web-midi-api/#dom-midiconnectioneventinit-port MIDIConnectionEventInit.port specification>
getPortUnchecked :: (MonadDOM m) => MIDIConnectionEventInit -> m MIDIPort
getPortUnchecked self = liftDOM ((pFromJSVal <$> (js_getPort (self))))