{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.ReadableStreamBYOBReader
(newReadableStreamBYOBReader, read, read_, cancel, cancel_,
releaseLock, getClosed, ReadableStreamBYOBReader(..),
gTypeReadableStreamBYOBReader)
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
newReadableStreamBYOBReader ::
(MonadDOM m) => ReadableStream -> m ReadableStreamBYOBReader
newReadableStreamBYOBReader stream
= liftDOM
(ReadableStreamBYOBReader <$>
new (jsg "ReadableStreamBYOBReader") [toJSVal stream])
read ::
(MonadDOM m, ToJSVal view) =>
ReadableStreamBYOBReader -> Maybe view -> m JSVal
read self view
= liftDOM
(((self ^. jsf "read" [toJSVal view]) >>= readPromise) >>= toJSVal)
read_ ::
(MonadDOM m, ToJSVal view) =>
ReadableStreamBYOBReader -> Maybe view -> m ()
read_ self view
= liftDOM (void (self ^. jsf "read" [toJSVal view]))
cancel ::
(MonadDOM m, ToJSVal reason) =>
ReadableStreamBYOBReader -> Maybe reason -> m JSVal
cancel self reason
= liftDOM
(((self ^. jsf "cancel" [toJSVal reason]) >>= readPromise) >>=
toJSVal)
cancel_ ::
(MonadDOM m, ToJSVal reason) =>
ReadableStreamBYOBReader -> Maybe reason -> m ()
cancel_ self reason
= liftDOM (void (self ^. jsf "cancel" [toJSVal reason]))
releaseLock :: (MonadDOM m) => ReadableStreamBYOBReader -> m ()
releaseLock self = liftDOM (void (self ^. jsf "releaseLock" ()))
getClosed :: (MonadDOM m) => ReadableStreamBYOBReader -> m Bool
getClosed self
= liftDOM (((self ^. js "closed") >>= readPromise) >>= valToBool)