{-# LANGUAGE PatternSynonyms #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.SQLTransactionCallback
       (newSQLTransactionCallback, newSQLTransactionCallbackSync,
        newSQLTransactionCallbackAsync, SQLTransactionCallback)
       where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SQLTransactionCallback Mozilla SQLTransactionCallback documentation> 
newSQLTransactionCallback ::
                          (MonadDOM m) =>
                            (SQLTransaction -> JSM ()) -> m SQLTransactionCallback
newSQLTransactionCallback :: forall (m :: * -> *).
MonadDOM m =>
(SQLTransaction -> JSM ()) -> m SQLTransactionCallback
newSQLTransactionCallback SQLTransaction -> JSM ()
callback
  = DOM SQLTransactionCallback -> m SQLTransactionCallback
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (Callback (JSVal -> IO ()) -> SQLTransactionCallback
SQLTransactionCallback (Callback (JSVal -> IO ()) -> SQLTransactionCallback)
-> (Function -> Callback (JSVal -> IO ()))
-> Function
-> SQLTransactionCallback
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Function -> Callback (JSVal -> IO ())
forall a. Function -> Callback a
Callback (Function -> SQLTransactionCallback)
-> JSM Function -> DOM SQLTransactionCallback
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
         JSCallAsFunction -> JSM Function
function
           (\ JSVal
_ JSVal
_ [JSVal
transaction] ->
              JSVal -> JSM SQLTransaction
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked JSVal
transaction JSM SQLTransaction -> (SQLTransaction -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
                \ SQLTransaction
transaction' -> SQLTransaction -> JSM ()
callback SQLTransaction
transaction'))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SQLTransactionCallback Mozilla SQLTransactionCallback documentation> 
newSQLTransactionCallbackSync ::
                              (MonadDOM m) =>
                                (SQLTransaction -> JSM ()) -> m SQLTransactionCallback
newSQLTransactionCallbackSync :: forall (m :: * -> *).
MonadDOM m =>
(SQLTransaction -> JSM ()) -> m SQLTransactionCallback
newSQLTransactionCallbackSync SQLTransaction -> JSM ()
callback
  = DOM SQLTransactionCallback -> m SQLTransactionCallback
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (Callback (JSVal -> IO ()) -> SQLTransactionCallback
SQLTransactionCallback (Callback (JSVal -> IO ()) -> SQLTransactionCallback)
-> (Function -> Callback (JSVal -> IO ()))
-> Function
-> SQLTransactionCallback
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Function -> Callback (JSVal -> IO ())
forall a. Function -> Callback a
Callback (Function -> SQLTransactionCallback)
-> JSM Function -> DOM SQLTransactionCallback
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
         JSCallAsFunction -> JSM Function
function
           (\ JSVal
_ JSVal
_ [JSVal
transaction] ->
              JSVal -> JSM SQLTransaction
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked JSVal
transaction JSM SQLTransaction -> (SQLTransaction -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
                \ SQLTransaction
transaction' -> SQLTransaction -> JSM ()
callback SQLTransaction
transaction'))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SQLTransactionCallback Mozilla SQLTransactionCallback documentation> 
newSQLTransactionCallbackAsync ::
                               (MonadDOM m) =>
                                 (SQLTransaction -> JSM ()) -> m SQLTransactionCallback
newSQLTransactionCallbackAsync :: forall (m :: * -> *).
MonadDOM m =>
(SQLTransaction -> JSM ()) -> m SQLTransactionCallback
newSQLTransactionCallbackAsync SQLTransaction -> JSM ()
callback
  = DOM SQLTransactionCallback -> m SQLTransactionCallback
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (Callback (JSVal -> IO ()) -> SQLTransactionCallback
SQLTransactionCallback (Callback (JSVal -> IO ()) -> SQLTransactionCallback)
-> (Function -> Callback (JSVal -> IO ()))
-> Function
-> SQLTransactionCallback
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Function -> Callback (JSVal -> IO ())
forall a. Function -> Callback a
Callback (Function -> SQLTransactionCallback)
-> JSM Function -> DOM SQLTransactionCallback
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
         JSCallAsFunction -> JSM Function
asyncFunction
           (\ JSVal
_ JSVal
_ [JSVal
transaction] ->
              JSVal -> JSM SQLTransaction
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked JSVal
transaction JSM SQLTransaction -> (SQLTransaction -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
                \ SQLTransaction
transaction' -> SQLTransaction -> JSM ()
callback SQLTransaction
transaction'))