{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-} module GHCJS.DOM.JSFFI.Generated.ReadableStream (js_newReadableStream, newReadableStream, js_read, read, read_, readUnchecked, js_cancel, cancel, cancel_, cancelUnchecked, js_pipeTo, pipeTo, pipeTo_, pipeToUnchecked, js_pipeThrough, pipeThrough, pipeThrough_, pipeThroughUnchecked, js_getState, getState, js_getClosed, getClosed, getClosedUnchecked, js_getReady, getReady, getReadyUnchecked, ReadableStream, castToReadableStream, gTypeReadableStream) where import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, fmap, Show, Read, Eq, Ord) import Data.Typeable (Typeable) import GHCJS.Types (JSVal(..), JSString) import GHCJS.Foreign (jsNull) import GHCJS.Foreign.Callback (syncCallback, asyncCallback, syncCallback1, asyncCallback1, syncCallback2, asyncCallback2, OnBlocked(..)) import GHCJS.Marshal (ToJSVal(..), FromJSVal(..)) import GHCJS.Marshal.Pure (PToJSVal(..), PFromJSVal(..)) import Control.Monad (void) import Control.Monad.IO.Class (MonadIO(..)) import Data.Int (Int64) import Data.Word (Word, Word64) import Data.Maybe (fromJust) import GHCJS.DOM.Types import Control.Applicative ((<$>)) import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName) import GHCJS.DOM.JSFFI.Generated.Enums foreign import javascript unsafe "new window[\"ReadableStream\"]($1)" js_newReadableStream :: JSVal -> IO ReadableStream -- | newReadableStream :: (MonadIO m) => JSVal -> m ReadableStream newReadableStream properties = liftIO (js_newReadableStream properties) foreign import javascript unsafe "$1[\"read\"]()" js_read :: ReadableStream -> IO (Nullable GObject) -- | read :: (MonadIO m) => ReadableStream -> m (Maybe GObject) read self = liftIO (nullableToMaybe <$> (js_read (self))) -- | read_ :: (MonadIO m) => ReadableStream -> m () read_ self = liftIO (void (js_read (self))) -- | readUnchecked :: (MonadIO m) => ReadableStream -> m GObject readUnchecked self = liftIO (fromJust . nullableToMaybe <$> (js_read (self))) foreign import javascript unsafe "$1[\"cancel\"]($2)" js_cancel :: ReadableStream -> JSString -> IO (Nullable Promise) -- | cancel :: (MonadIO m, ToJSString reason) => ReadableStream -> reason -> m (Maybe Promise) cancel self reason = liftIO (nullableToMaybe <$> (js_cancel (self) (toJSString reason))) -- | cancel_ :: (MonadIO m, ToJSString reason) => ReadableStream -> reason -> m () cancel_ self reason = liftIO (void (js_cancel (self) (toJSString reason))) -- | cancelUnchecked :: (MonadIO m, ToJSString reason) => ReadableStream -> reason -> m Promise cancelUnchecked self reason = liftIO (fromJust . nullableToMaybe <$> (js_cancel (self) (toJSString reason))) foreign import javascript unsafe "$1[\"pipeTo\"]($2, $3)" js_pipeTo :: ReadableStream -> JSVal -> JSVal -> IO (Nullable Promise) -- | pipeTo :: (MonadIO m) => ReadableStream -> JSVal -> JSVal -> m (Maybe Promise) pipeTo self streams options = liftIO (nullableToMaybe <$> (js_pipeTo (self) streams options)) -- | pipeTo_ :: (MonadIO m) => ReadableStream -> JSVal -> JSVal -> m () pipeTo_ self streams options = liftIO (void (js_pipeTo (self) streams options)) -- | pipeToUnchecked :: (MonadIO m) => ReadableStream -> JSVal -> JSVal -> m Promise pipeToUnchecked self streams options = liftIO (fromJust . nullableToMaybe <$> (js_pipeTo (self) streams options)) foreign import javascript unsafe "$1[\"pipeThrough\"]($2, $3)" js_pipeThrough :: ReadableStream -> JSVal -> JSVal -> IO (Nullable GObject) -- | pipeThrough :: (MonadIO m) => ReadableStream -> JSVal -> JSVal -> m (Maybe GObject) pipeThrough self dest options = liftIO (nullableToMaybe <$> (js_pipeThrough (self) dest options)) -- | pipeThrough_ :: (MonadIO m) => ReadableStream -> JSVal -> JSVal -> m () pipeThrough_ self dest options = liftIO (void (js_pipeThrough (self) dest options)) -- | pipeThroughUnchecked :: (MonadIO m) => ReadableStream -> JSVal -> JSVal -> m GObject pipeThroughUnchecked self dest options = liftIO (fromJust . nullableToMaybe <$> (js_pipeThrough (self) dest options)) foreign import javascript unsafe "$1[\"state\"]" js_getState :: ReadableStream -> IO JSVal -- | getState :: (MonadIO m) => ReadableStream -> m ReadableStreamStateType getState self = liftIO ((js_getState (self)) >>= fromJSValUnchecked) foreign import javascript unsafe "$1[\"closed\"]" js_getClosed :: ReadableStream -> IO (Nullable Promise) -- | getClosed :: (MonadIO m) => ReadableStream -> m (Maybe Promise) getClosed self = liftIO (nullableToMaybe <$> (js_getClosed (self))) -- | getClosedUnchecked :: (MonadIO m) => ReadableStream -> m Promise getClosedUnchecked self = liftIO (fromJust . nullableToMaybe <$> (js_getClosed (self))) foreign import javascript unsafe "$1[\"ready\"]" js_getReady :: ReadableStream -> IO (Nullable Promise) -- | getReady :: (MonadIO m) => ReadableStream -> m (Maybe Promise) getReady self = liftIO (nullableToMaybe <$> (js_getReady (self))) -- | getReadyUnchecked :: (MonadIO m) => ReadableStream -> m Promise getReadyUnchecked self = liftIO (fromJust . nullableToMaybe <$> (js_getReady (self)))