packages feed

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

{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from trusted-types (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.CreateParserOptionsCallback
       (newCreateParserOptionsCallback, newCreateParserOptionsCallbackSync, newCreateParserOptionsCallbackAsync, CreateParserOptionsCallback)
       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(..), syncCallback2, asyncCallback2)
import GHCJS.DOM.Types
import GHCJS.DOM.JSFFI.Generated.Enums

newCreateParserOptionsCallback :: (MonadDOM m) => (SetHTMLUnsafeOptions -> JSVal -> IO ()) -> m CreateParserOptionsCallback
newCreateParserOptionsCallback callback = liftDOM ((CreateParserOptionsCallback . coerce) <$> syncCallback2 ContinueAsync (\ options arguments -> do
          options' <- fromJSValUnchecked options
          arguments' <- P.return arguments
          callback options' arguments'))

newCreateParserOptionsCallbackSync :: (MonadDOM m) => (SetHTMLUnsafeOptions -> JSVal -> IO ()) -> m CreateParserOptionsCallback
newCreateParserOptionsCallbackSync callback = liftDOM ((CreateParserOptionsCallback . coerce) <$> syncCallback2 ThrowWouldBlock (\ options arguments -> do
          options' <- fromJSValUnchecked options
          arguments' <- P.return arguments
          callback options' arguments'))

newCreateParserOptionsCallbackAsync :: (MonadDOM m) => (SetHTMLUnsafeOptions -> JSVal -> IO ()) -> m CreateParserOptionsCallback
newCreateParserOptionsCallbackAsync callback = liftDOM ((CreateParserOptionsCallback . coerce) <$> asyncCallback2 (\ options arguments -> do
          options' <- fromJSValUnchecked options
          arguments' <- P.return arguments
          callback options' arguments'))