module JSDOM.Generated.ReadableStreamDefaultReader
(newReadableStreamDefaultReader, read, read_, cancel, cancel_,
releaseLock, getClosed, ReadableStreamDefaultReader(..),
gTypeReadableStreamDefaultReader)
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)
import JSDOM.Enums
newReadableStreamDefaultReader ::
(MonadDOM m) => ReadableStream -> m ReadableStreamDefaultReader
newReadableStreamDefaultReader stream
= liftDOM
(ReadableStreamDefaultReader <$>
new (jsg "ReadableStreamDefaultReader") [toJSVal stream])
read :: (MonadDOM m) => ReadableStreamDefaultReader -> m JSVal
read self
= liftDOM (((self ^. jsf "read" ()) >>= readPromise) >>= toJSVal)
read_ :: (MonadDOM m) => ReadableStreamDefaultReader -> m ()
read_ self = liftDOM (void (self ^. jsf "read" ()))
cancel ::
(MonadDOM m, ToJSVal reason) =>
ReadableStreamDefaultReader -> Maybe reason -> m JSVal
cancel self reason
= liftDOM
(((self ^. jsf "cancel" [toJSVal reason]) >>= readPromise) >>=
toJSVal)
cancel_ ::
(MonadDOM m, ToJSVal reason) =>
ReadableStreamDefaultReader -> Maybe reason -> m ()
cancel_ self reason
= liftDOM (void (self ^. jsf "cancel" [toJSVal reason]))
releaseLock :: (MonadDOM m) => ReadableStreamDefaultReader -> m ()
releaseLock self = liftDOM (void (self ^. jsf "releaseLock" ()))
getClosed :: (MonadDOM m) => ReadableStreamDefaultReader -> m Bool
getClosed self
= liftDOM (((self ^. js "closed") >>= readPromise) >>= valToBool)