packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/DecodeErrorCallback.hs

{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webaudio-1.1 (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.DecodeErrorCallback
       (newDecodeErrorCallback, newDecodeErrorCallbackSync, newDecodeErrorCallbackAsync, DecodeErrorCallback)
       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

newDecodeErrorCallback :: (MonadDOM m) => (DOMException -> IO ()) -> m DecodeErrorCallback
newDecodeErrorCallback callback = liftDOM ((DecodeErrorCallback . coerce) <$> syncCallback1 ContinueAsync (\ error -> do
          error' <- fromJSValUnchecked error
          callback error'))

newDecodeErrorCallbackSync :: (MonadDOM m) => (DOMException -> IO ()) -> m DecodeErrorCallback
newDecodeErrorCallbackSync callback = liftDOM ((DecodeErrorCallback . coerce) <$> syncCallback1 ThrowWouldBlock (\ error -> do
          error' <- fromJSValUnchecked error
          callback error'))

newDecodeErrorCallbackAsync :: (MonadDOM m) => (DOMException -> IO ()) -> m DecodeErrorCallback
newDecodeErrorCallbackAsync callback = liftDOM ((DecodeErrorCallback . coerce) <$> asyncCallback1 (\ error -> do
          error' <- fromJSValUnchecked error
          callback error'))