ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/IDBDatabase.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from IndexedDB-3 (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.IDBDatabase
(js_close, js_createObjectStore, js_deleteObjectStore, js_transaction, js_transaction', js_getName, js_getVersion, js_getObjectStoreNames, close, createObjectStore, createObjectStore_, deleteObjectStore, transaction, transaction_, transaction', transaction'_, getName, getVersion, getObjectStoreNames, abort, closeEvent, error, versionChange, IDBDatabase(..), gTypeIDBDatabase)
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 GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(($1) => { return $1[\"close\"](); })"
js_close :: IDBDatabase -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/close MDN IDBDatabase.close documentation>
close :: (MonadDOM m) => IDBDatabase -> m ()
close self = liftDOM (void ((js_close (self))))
foreign import javascript safe "(($1, $2, $3) => { return $1[\"createObjectStore\"]($2, $3); })"
js_createObjectStore :: IDBDatabase -> JSString -> JSVal -> IO IDBObjectStore
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/createObjectStore MDN IDBDatabase.createObjectStore documentation>
createObjectStore :: (MonadDOM m, ToJSString name) => IDBDatabase -> name -> Maybe IDBObjectStoreParameters -> m IDBObjectStore
createObjectStore self name options = liftDOM (((P.maybe (P.return jsUndefined) toJSVal options) >>= \a3' -> js_createObjectStore (self) (toJSString name) a3'))
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/createObjectStore MDN IDBDatabase.createObjectStore documentation>
createObjectStore_ :: (MonadDOM m, ToJSString name) => IDBDatabase -> name -> Maybe IDBObjectStoreParameters -> m ()
createObjectStore_ self name options = liftDOM (void (((P.maybe (P.return jsUndefined) toJSVal options) >>= \a3' -> js_createObjectStore (self) (toJSString name) a3')))
foreign import javascript safe "(($1, $2) => { return $1[\"deleteObjectStore\"]($2); })"
js_deleteObjectStore :: IDBDatabase -> JSString -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/deleteObjectStore MDN IDBDatabase.deleteObjectStore documentation>
deleteObjectStore :: (MonadDOM m, ToJSString name) => IDBDatabase -> name -> m ()
deleteObjectStore self name = liftDOM (void ((js_deleteObjectStore (self) (toJSString name))))
foreign import javascript safe "(($1, $2, $3) => { return $1[\"transaction\"]($2, $3); })"
js_transaction :: IDBDatabase -> StringOrSequenceString -> JSVal -> IO IDBTransaction
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction MDN IDBDatabase.transaction documentation>
transaction :: (MonadDOM m, IsStringOrSequenceString storeNames) => IDBDatabase -> storeNames -> Maybe IDBTransactionMode -> m IDBTransaction
transaction self storeNames mode = liftDOM (((P.maybe (P.return jsUndefined) toJSVal mode) >>= \a3' -> js_transaction (self) (Types.toStringOrSequenceString storeNames) a3'))
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction MDN IDBDatabase.transaction documentation>
transaction_ :: (MonadDOM m, IsStringOrSequenceString storeNames) => IDBDatabase -> storeNames -> Maybe IDBTransactionMode -> m ()
transaction_ self storeNames mode = liftDOM (void (((P.maybe (P.return jsUndefined) toJSVal mode) >>= \a3' -> js_transaction (self) (Types.toStringOrSequenceString storeNames) a3')))
foreign import javascript safe "(($1, $2, $3, $4) => { return $1[\"transaction\"]($2, $3, $4); })"
js_transaction' :: IDBDatabase -> StringOrSequenceString -> JSVal -> JSVal -> IO IDBTransaction
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction MDN IDBDatabase.transaction documentation>
transaction' :: (MonadDOM m, IsStringOrSequenceString storeNames) => IDBDatabase -> storeNames -> Maybe IDBTransactionMode -> Maybe IDBTransactionOptions -> m IDBTransaction
transaction' self storeNames mode options = liftDOM (((P.maybe (P.return jsUndefined) toJSVal mode) >>= \a3' -> (P.maybe (P.return jsUndefined) toJSVal options) >>= \a4' -> js_transaction' (self) (Types.toStringOrSequenceString storeNames) a3' a4'))
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction MDN IDBDatabase.transaction documentation>
transaction'_ :: (MonadDOM m, IsStringOrSequenceString storeNames) => IDBDatabase -> storeNames -> Maybe IDBTransactionMode -> Maybe IDBTransactionOptions -> m ()
transaction'_ self storeNames mode options = liftDOM (void (((P.maybe (P.return jsUndefined) toJSVal mode) >>= \a3' -> (P.maybe (P.return jsUndefined) toJSVal options) >>= \a4' -> js_transaction' (self) (Types.toStringOrSequenceString storeNames) a3' a4')))
foreign import javascript unsafe "(($1) => { return $1[\"name\"]; })"
js_getName :: IDBDatabase -> IO JSString
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/name MDN IDBDatabase.name documentation>
getName :: (MonadDOM m, FromJSString result) => IDBDatabase -> m result
getName self = liftDOM ((fromJSString <$> (js_getName (self))))
foreign import javascript unsafe "(($1) => { return $1[\"version\"]; })"
js_getVersion :: IDBDatabase -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/version MDN IDBDatabase.version documentation>
getVersion :: (MonadDOM m) => IDBDatabase -> m Word53
getVersion self = liftDOM (((js_getVersion (self)) >>= fromJSValUnchecked))
foreign import javascript unsafe "(($1) => { return $1[\"objectStoreNames\"]; })"
js_getObjectStoreNames :: IDBDatabase -> IO DOMStringList
-- | <https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames MDN IDBDatabase.objectStoreNames documentation>
getObjectStoreNames :: (MonadDOM m) => IDBDatabase -> m DOMStringList
getObjectStoreNames self = liftDOM ((js_getObjectStoreNames (self)))
-- | <https://w3c.github.io/IndexedDB/#dom-idbdatabase-onabort abort event>
abort :: EventName IDBDatabase Event
abort = unsafeEventName (toJSString "abort")
-- | <https://w3c.github.io/IndexedDB/#dom-idbdatabase-onclose close event>
closeEvent :: EventName IDBDatabase Event
closeEvent = unsafeEventNameAsync (toJSString "close")
-- | <https://w3c.github.io/IndexedDB/#dom-idbdatabase-onerror error event>
error :: EventName IDBDatabase Event
error = unsafeEventName (toJSString "error")
-- | <https://w3c.github.io/IndexedDB/#dom-idbdatabase-onversionchange versionchange event>
versionChange :: EventName IDBDatabase IDBVersionChangeEvent
versionChange = unsafeEventName (toJSString "versionchange")