{-# LANGUAGE PatternSynonyms #-} -- For HasCallStack compatibility {-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} module JSDOM.Generated.IDBTransaction (objectStore, objectStore_, objectStoreUnsafe, objectStoreUnchecked, abort, getMode, getDb, getDbUnsafe, getDbUnchecked, getError, getErrorUnsafe, getErrorUnchecked, abortEvent, complete, error, IDBTransaction(..), gTypeIDBTransaction) 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 Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, new, array) 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) import JSDOM.Enums -- | objectStore :: (MonadDOM m, ToJSString name) => IDBTransaction -> name -> m (Maybe IDBObjectStore) objectStore self name = liftDOM ((self ^. jsf "objectStore" [toJSVal name]) >>= fromJSVal) -- | objectStore_ :: (MonadDOM m, ToJSString name) => IDBTransaction -> name -> m () objectStore_ self name = liftDOM (void (self ^. jsf "objectStore" [toJSVal name])) -- | objectStoreUnsafe :: (MonadDOM m, ToJSString name, HasCallStack) => IDBTransaction -> name -> m IDBObjectStore objectStoreUnsafe self name = liftDOM (((self ^. jsf "objectStore" [toJSVal name]) >>= fromJSVal) >>= maybe (Prelude.error "Nothing to return") return) -- | objectStoreUnchecked :: (MonadDOM m, ToJSString name) => IDBTransaction -> name -> m IDBObjectStore objectStoreUnchecked self name = liftDOM ((self ^. jsf "objectStore" [toJSVal name]) >>= fromJSValUnchecked) -- | abort :: (MonadDOM m) => IDBTransaction -> m () abort self = liftDOM (void (self ^. jsf "abort" ())) -- | getMode :: (MonadDOM m, FromJSString result) => IDBTransaction -> m result getMode self = liftDOM ((self ^. js "mode") >>= fromJSValUnchecked) -- | getDb :: (MonadDOM m) => IDBTransaction -> m (Maybe IDBDatabase) getDb self = liftDOM ((self ^. js "db") >>= fromJSVal) -- | getDbUnsafe :: (MonadDOM m, HasCallStack) => IDBTransaction -> m IDBDatabase getDbUnsafe self = liftDOM (((self ^. js "db") >>= fromJSVal) >>= maybe (Prelude.error "Nothing to return") return) -- | getDbUnchecked :: (MonadDOM m) => IDBTransaction -> m IDBDatabase getDbUnchecked self = liftDOM ((self ^. js "db") >>= fromJSValUnchecked) -- | getError :: (MonadDOM m) => IDBTransaction -> m (Maybe DOMError) getError self = liftDOM ((self ^. js "error") >>= fromJSVal) -- | getErrorUnsafe :: (MonadDOM m, HasCallStack) => IDBTransaction -> m DOMError getErrorUnsafe self = liftDOM (((self ^. js "error") >>= fromJSVal) >>= maybe (Prelude.error "Nothing to return") return) -- | getErrorUnchecked :: (MonadDOM m) => IDBTransaction -> m DOMError getErrorUnchecked self = liftDOM ((self ^. js "error") >>= fromJSValUnchecked) -- | abortEvent :: EventName IDBTransaction Event abortEvent = unsafeEventName (toJSString "abort") -- | complete :: EventName IDBTransaction Event complete = unsafeEventName (toJSString "complete") -- | error :: EventName IDBTransaction Event error = unsafeEventName (toJSString "error")