packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/IDBGetAllOptions.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from IndexedDB-3 (webref). Do not edit.
module JSDOM.Generated.IDBGetAllOptions
       (newIDBGetAllOptions, setQuery, getQuery, setCount, getCount, getCountUnsafe, getCountUnchecked, setDirection, getDirection, getDirectionUnsafe, getDirectionUnchecked, IDBGetAllOptions(..), gTypeIDBGetAllOptions)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums

-- | <https://w3c.github.io/IndexedDB/#dictdef-idbgetalloptions IDBGetAllOptions specification>
newIDBGetAllOptions :: (MonadDOM m) => m IDBGetAllOptions
newIDBGetAllOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-query IDBGetAllOptions.query specification>
setQuery :: (MonadDOM m) => IDBGetAllOptions -> JSVal -> m ()
setQuery self val = liftDOM (void (self ^. jss "query" (toJSVal val)))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-query IDBGetAllOptions.query specification>
getQuery :: (MonadDOM m) => IDBGetAllOptions -> m JSVal
getQuery self = liftDOM (self ^. js "query")

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-count IDBGetAllOptions.count specification>
setCount :: (MonadDOM m) => IDBGetAllOptions -> Word -> m ()
setCount self val = liftDOM (void (self ^. jss "count" (toJSVal val)))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-count IDBGetAllOptions.count specification>
getCount :: (MonadDOM m) => IDBGetAllOptions -> m (Maybe Word)
getCount self = liftDOM (((self ^. js "count") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-count IDBGetAllOptions.count specification>
getCountUnsafe :: (MonadDOM m, HasCallStack) => IDBGetAllOptions -> m Word
getCountUnsafe self = liftDOM ((((self ^. js "count") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-count IDBGetAllOptions.count specification>
getCountUnchecked :: (MonadDOM m) => IDBGetAllOptions -> m Word
getCountUnchecked self = liftDOM ((P.round <$> ((self ^. js "count") >>= valToNumber)))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-direction IDBGetAllOptions.direction specification>
setDirection :: (MonadDOM m) => IDBGetAllOptions -> IDBCursorDirection -> m ()
setDirection self val = liftDOM (void (self ^. jss "direction" (toJSVal val)))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-direction IDBGetAllOptions.direction specification>
getDirection :: (MonadDOM m) => IDBGetAllOptions -> m (Maybe IDBCursorDirection)
getDirection self = liftDOM (((self ^. js "direction") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-direction IDBGetAllOptions.direction specification>
getDirectionUnsafe :: (MonadDOM m, HasCallStack) => IDBGetAllOptions -> m IDBCursorDirection
getDirectionUnsafe self = liftDOM ((((self ^. js "direction") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/IndexedDB/#dom-idbgetalloptions-direction IDBGetAllOptions.direction specification>
getDirectionUnchecked :: (MonadDOM m) => IDBGetAllOptions -> m IDBCursorDirection
getDirectionUnchecked self = liftDOM (((self ^. js "direction") >>= fromJSValUnchecked))