ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/DecodeSuccessCallback.hs
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webaudio-1.1 (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.DecodeSuccessCallback
(newDecodeSuccessCallback, newDecodeSuccessCallbackSync, newDecodeSuccessCallbackAsync, DecodeSuccessCallback)
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 Data.Coerce (coerce)
import GHC.JS.Foreign.Callback (OnBlocked(..), syncCallback1, asyncCallback1)
import GHCJS.DOM.Types
import GHCJS.DOM.JSFFI.Generated.Enums
newDecodeSuccessCallback :: (MonadDOM m) => (AudioBuffer -> IO ()) -> m DecodeSuccessCallback
newDecodeSuccessCallback callback = liftDOM ((DecodeSuccessCallback . coerce) <$> syncCallback1 ContinueAsync (\ decodedData -> do
decodedData' <- fromJSValUnchecked decodedData
callback decodedData'))
newDecodeSuccessCallbackSync :: (MonadDOM m) => (AudioBuffer -> IO ()) -> m DecodeSuccessCallback
newDecodeSuccessCallbackSync callback = liftDOM ((DecodeSuccessCallback . coerce) <$> syncCallback1 ThrowWouldBlock (\ decodedData -> do
decodedData' <- fromJSValUnchecked decodedData
callback decodedData'))
newDecodeSuccessCallbackAsync :: (MonadDOM m) => (AudioBuffer -> IO ()) -> m DecodeSuccessCallback
newDecodeSuccessCallbackAsync callback = liftDOM ((DecodeSuccessCallback . coerce) <$> asyncCallback1 (\ decodedData -> do
decodedData' <- fromJSValUnchecked decodedData
callback decodedData'))