packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from streams (webref). Do not edit.
module JSDOM.Generated.ReadableStreamBYOBReaderReadOptions
       (newReadableStreamBYOBReaderReadOptions, setMin, getMin, getMinUnsafe, getMinUnchecked, ReadableStreamBYOBReaderReadOptions(..), gTypeReadableStreamBYOBReaderReadOptions)
       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://streams.spec.whatwg.org/#dictdef-readablestreambyobreaderreadoptions ReadableStreamBYOBReaderReadOptions specification>
newReadableStreamBYOBReaderReadOptions :: (MonadDOM m) => m ReadableStreamBYOBReaderReadOptions
newReadableStreamBYOBReaderReadOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://streams.spec.whatwg.org/#dom-readablestreambyobreaderreadoptions-min ReadableStreamBYOBReaderReadOptions.min specification>
setMin :: (MonadDOM m) => ReadableStreamBYOBReaderReadOptions -> Word53 -> m ()
setMin self val = liftDOM (void (self ^. jss "min" (toJSVal val)))

-- | <https://streams.spec.whatwg.org/#dom-readablestreambyobreaderreadoptions-min ReadableStreamBYOBReaderReadOptions.min specification>
getMin :: (MonadDOM m) => ReadableStreamBYOBReaderReadOptions -> m (Maybe Word53)
getMin self = liftDOM (((self ^. js "min") >>= fromJSValUnchecked))

-- | <https://streams.spec.whatwg.org/#dom-readablestreambyobreaderreadoptions-min ReadableStreamBYOBReaderReadOptions.min specification>
getMinUnsafe :: (MonadDOM m, HasCallStack) => ReadableStreamBYOBReaderReadOptions -> m Word53
getMinUnsafe self = liftDOM ((((self ^. js "min") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://streams.spec.whatwg.org/#dom-readablestreambyobreaderreadoptions-min ReadableStreamBYOBReaderReadOptions.min specification>
getMinUnchecked :: (MonadDOM m) => ReadableStreamBYOBReaderReadOptions -> m Word53
getMinUnchecked self = liftDOM (((self ^. js "min") >>= fromJSValUnchecked))