{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE JavaScriptFFI #-} -- For HasCallStack compatibility {-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-} module GHCJS.DOM.JSFFI.Generated.IDBTransaction (js_objectStore, objectStore, objectStore_, objectStoreUnsafe, objectStoreUnchecked, js_abort, abort, js_getMode, getMode, js_getDb, getDb, getDbUnsafe, getDbUnchecked, js_getError, getError, getErrorUnsafe, getErrorUnchecked, abortEvent, complete, error, IDBTransaction(..), gTypeIDBTransaction) where import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, fmap, Show, Read, Eq, Ord) import qualified Prelude (error) import Data.Typeable (Typeable) import GHCJS.Types (JSVal(..), JSString) import GHCJS.Foreign (jsNull) import GHCJS.Foreign.Callback (syncCallback, asyncCallback, syncCallback1, asyncCallback1, syncCallback2, asyncCallback2, OnBlocked(..)) import GHCJS.Marshal (ToJSVal(..), FromJSVal(..)) import GHCJS.Marshal.Pure (PToJSVal(..), PFromJSVal(..)) import Control.Monad (void) import Control.Monad.IO.Class (MonadIO(..)) import Data.Int (Int64) import Data.Word (Word, Word64) import Data.Maybe (fromJust) import GHCJS.DOM.Types import Control.Applicative ((<$>)) import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName) import GHCJS.DOM.JSFFI.Generated.Enums foreign import javascript unsafe "$1[\"objectStore\"]($2)" js_objectStore :: IDBTransaction -> JSString -> IO (Nullable IDBObjectStore) -- | objectStore :: (MonadIO m, ToJSString name) => IDBTransaction -> name -> m (Maybe IDBObjectStore) objectStore self name = liftIO (nullableToMaybe <$> (js_objectStore (self) (toJSString name))) -- | objectStore_ :: (MonadIO m, ToJSString name) => IDBTransaction -> name -> m () objectStore_ self name = liftIO (void (js_objectStore (self) (toJSString name))) -- | objectStoreUnsafe :: (MonadIO m, ToJSString name, HasCallStack) => IDBTransaction -> name -> m IDBObjectStore objectStoreUnsafe self name = liftIO ((nullableToMaybe <$> (js_objectStore (self) (toJSString name))) >>= maybe (Prelude.error "Nothing to return") return) -- | objectStoreUnchecked :: (MonadIO m, ToJSString name) => IDBTransaction -> name -> m IDBObjectStore objectStoreUnchecked self name = liftIO (fromJust . nullableToMaybe <$> (js_objectStore (self) (toJSString name))) foreign import javascript unsafe "$1[\"abort\"]()" js_abort :: IDBTransaction -> IO () -- | abort :: (MonadIO m) => IDBTransaction -> m () abort self = liftIO (js_abort (self)) foreign import javascript unsafe "$1[\"mode\"]" js_getMode :: IDBTransaction -> IO JSString -- | getMode :: (MonadIO m, FromJSString result) => IDBTransaction -> m result getMode self = liftIO (fromJSString <$> (js_getMode (self))) foreign import javascript unsafe "$1[\"db\"]" js_getDb :: IDBTransaction -> IO (Nullable IDBDatabase) -- | getDb :: (MonadIO m) => IDBTransaction -> m (Maybe IDBDatabase) getDb self = liftIO (nullableToMaybe <$> (js_getDb (self))) -- | getDbUnsafe :: (MonadIO m, HasCallStack) => IDBTransaction -> m IDBDatabase getDbUnsafe self = liftIO ((nullableToMaybe <$> (js_getDb (self))) >>= maybe (Prelude.error "Nothing to return") return) -- | getDbUnchecked :: (MonadIO m) => IDBTransaction -> m IDBDatabase getDbUnchecked self = liftIO (fromJust . nullableToMaybe <$> (js_getDb (self))) foreign import javascript unsafe "$1[\"error\"]" js_getError :: IDBTransaction -> IO (Nullable DOMError) -- | getError :: (MonadIO m) => IDBTransaction -> m (Maybe DOMError) getError self = liftIO (nullableToMaybe <$> (js_getError (self))) -- | getErrorUnsafe :: (MonadIO m, HasCallStack) => IDBTransaction -> m DOMError getErrorUnsafe self = liftIO ((nullableToMaybe <$> (js_getError (self))) >>= maybe (Prelude.error "Nothing to return") return) -- | getErrorUnchecked :: (MonadIO m) => IDBTransaction -> m DOMError getErrorUnchecked self = liftIO (fromJust . nullableToMaybe <$> (js_getError (self))) -- | abortEvent :: EventName IDBTransaction Event abortEvent = unsafeEventName (toJSString "abort") -- | complete :: EventName IDBTransaction Event complete = unsafeEventName (toJSString "complete") -- | error :: EventName IDBTransaction Event error = unsafeEventName (toJSString "error")