{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.IDBFactory
(open, open_, deleteDatabase, deleteDatabase_, cmp, cmp_,
IDBFactory(..), gTypeIDBFactory)
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
open ::
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> Maybe Word64 -> m IDBOpenDBRequest
open :: forall (m :: * -> *) name.
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> Maybe Word64 -> m IDBOpenDBRequest
open IDBFactory
self name
name Maybe Word64
version
= DOM IDBOpenDBRequest -> m IDBOpenDBRequest
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
((IDBFactory
self IDBFactory
-> Getting (JSM JSVal) IDBFactory (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"open"
[name -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal name
name,
JSM JSVal -> (Word64 -> JSM JSVal) -> Maybe Word64 -> JSM JSVal
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (JSVal -> JSM JSVal
forall a. a -> JSM a
forall (m :: * -> *) a. Monad m => a -> m a
return JSVal
jsUndefined) Word64 -> JSM JSVal
forall a. Integral a => a -> JSM JSVal
integralToDoubleToJSVal Maybe Word64
version])
JSM JSVal
-> (JSVal -> DOM IDBOpenDBRequest) -> DOM IDBOpenDBRequest
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM IDBOpenDBRequest
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
open_ ::
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> Maybe Word64 -> m ()
open_ :: forall (m :: * -> *) name.
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> Maybe Word64 -> m ()
open_ IDBFactory
self name
name Maybe Word64
version
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
(IDBFactory
self IDBFactory
-> Getting (JSM JSVal) IDBFactory (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"open"
[name -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal name
name,
JSM JSVal -> (Word64 -> JSM JSVal) -> Maybe Word64 -> JSM JSVal
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (JSVal -> JSM JSVal
forall a. a -> JSM a
forall (m :: * -> *) a. Monad m => a -> m a
return JSVal
jsUndefined) Word64 -> JSM JSVal
forall a. Integral a => a -> JSM JSVal
integralToDoubleToJSVal Maybe Word64
version]))
deleteDatabase ::
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> m IDBOpenDBRequest
deleteDatabase :: forall (m :: * -> *) name.
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> m IDBOpenDBRequest
deleteDatabase IDBFactory
self name
name
= DOM IDBOpenDBRequest -> m IDBOpenDBRequest
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
((IDBFactory
self IDBFactory
-> Getting (JSM JSVal) IDBFactory (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"deleteDatabase" [name -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal name
name]) JSM JSVal
-> (JSVal -> DOM IDBOpenDBRequest) -> DOM IDBOpenDBRequest
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
JSVal -> DOM IDBOpenDBRequest
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
deleteDatabase_ ::
(MonadDOM m, ToJSString name) => IDBFactory -> name -> m ()
deleteDatabase_ :: forall (m :: * -> *) name.
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> m ()
deleteDatabase_ IDBFactory
self name
name
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (IDBFactory
self IDBFactory
-> Getting (JSM JSVal) IDBFactory (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"deleteDatabase" [name -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal name
name]))
cmp ::
(MonadDOM m, ToJSVal first, ToJSVal second) =>
IDBFactory -> first -> second -> m Int
cmp :: forall (m :: * -> *) first second.
(MonadDOM m, ToJSVal first, ToJSVal second) =>
IDBFactory -> first -> second -> m Int
cmp IDBFactory
self first
first second
second
= DOM Int -> m Int
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(Double -> Int
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Int) -> JSM Double -> DOM Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
((IDBFactory
self IDBFactory
-> Getting (JSM JSVal) IDBFactory (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"cmp" [first -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal first
first, second -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal second
second]) JSM JSVal -> (JSVal -> JSM Double) -> JSM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
JSVal -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))
cmp_ ::
(MonadDOM m, ToJSVal first, ToJSVal second) =>
IDBFactory -> first -> second -> m ()
cmp_ :: forall (m :: * -> *) first second.
(MonadDOM m, ToJSVal first, ToJSVal second) =>
IDBFactory -> first -> second -> m ()
cmp_ IDBFactory
self first
first second
second
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (IDBFactory
self IDBFactory
-> Getting (JSM JSVal) IDBFactory (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"cmp" [first -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal first
first, second -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal second
second]))