{-# 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 self name version
= liftDOM
((self ^. jsf "open"
[toJSVal name,
maybe (return jsUndefined) integralToDoubleToJSVal version])
>>= fromJSValUnchecked)
open_ ::
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> Maybe Word64 -> m ()
open_ self name version
= liftDOM
(void
(self ^. jsf "open"
[toJSVal name,
maybe (return jsUndefined) integralToDoubleToJSVal version]))
deleteDatabase ::
(MonadDOM m, ToJSString name) =>
IDBFactory -> name -> m IDBOpenDBRequest
deleteDatabase self name
= liftDOM
((self ^. jsf "deleteDatabase" [toJSVal name]) >>=
fromJSValUnchecked)
deleteDatabase_ ::
(MonadDOM m, ToJSString name) => IDBFactory -> name -> m ()
deleteDatabase_ self name
= liftDOM (void (self ^. jsf "deleteDatabase" [toJSVal name]))
cmp ::
(MonadDOM m, ToJSVal first, ToJSVal second) =>
IDBFactory -> first -> second -> m Int
cmp self first second
= liftDOM
(round <$>
((self ^. jsf "cmp" [toJSVal first, toJSVal second]) >>=
valToNumber))
cmp_ ::
(MonadDOM m, ToJSVal first, ToJSVal second) =>
IDBFactory -> first -> second -> m ()
cmp_ self first second
= liftDOM
(void (self ^. jsf "cmp" [toJSVal first, toJSVal second]))