packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/StreamPipeOptions.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.StreamPipeOptions
       (newStreamPipeOptions, setPreventClose, getPreventClose, getPreventCloseUnsafe, getPreventCloseUnchecked, setPreventAbort, getPreventAbort, getPreventAbortUnsafe, getPreventAbortUnchecked, setPreventCancel, getPreventCancel, getPreventCancelUnsafe, getPreventCancelUnchecked, setSignal, getSignal, getSignalUnsafe, getSignalUnchecked, StreamPipeOptions(..), gTypeStreamPipeOptions)
       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-streampipeoptions StreamPipeOptions specification>
newStreamPipeOptions :: (MonadDOM m) => m StreamPipeOptions
newStreamPipeOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventclose StreamPipeOptions.preventClose specification>
setPreventClose :: (MonadDOM m) => StreamPipeOptions -> Bool -> m ()
setPreventClose self val = liftDOM (void (self ^. jss "preventClose" (toJSVal val)))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventclose StreamPipeOptions.preventClose specification>
getPreventClose :: (MonadDOM m) => StreamPipeOptions -> m (Maybe Bool)
getPreventClose self = liftDOM (((self ^. js "preventClose") >>= fromJSValUnchecked))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventclose StreamPipeOptions.preventClose specification>
getPreventCloseUnsafe :: (MonadDOM m, HasCallStack) => StreamPipeOptions -> m Bool
getPreventCloseUnsafe self = liftDOM ((((self ^. js "preventClose") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventclose StreamPipeOptions.preventClose specification>
getPreventCloseUnchecked :: (MonadDOM m) => StreamPipeOptions -> m Bool
getPreventCloseUnchecked self = liftDOM (((self ^. js "preventClose") >>= valToBool))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventabort StreamPipeOptions.preventAbort specification>
setPreventAbort :: (MonadDOM m) => StreamPipeOptions -> Bool -> m ()
setPreventAbort self val = liftDOM (void (self ^. jss "preventAbort" (toJSVal val)))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventabort StreamPipeOptions.preventAbort specification>
getPreventAbort :: (MonadDOM m) => StreamPipeOptions -> m (Maybe Bool)
getPreventAbort self = liftDOM (((self ^. js "preventAbort") >>= fromJSValUnchecked))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventabort StreamPipeOptions.preventAbort specification>
getPreventAbortUnsafe :: (MonadDOM m, HasCallStack) => StreamPipeOptions -> m Bool
getPreventAbortUnsafe self = liftDOM ((((self ^. js "preventAbort") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventabort StreamPipeOptions.preventAbort specification>
getPreventAbortUnchecked :: (MonadDOM m) => StreamPipeOptions -> m Bool
getPreventAbortUnchecked self = liftDOM (((self ^. js "preventAbort") >>= valToBool))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventcancel StreamPipeOptions.preventCancel specification>
setPreventCancel :: (MonadDOM m) => StreamPipeOptions -> Bool -> m ()
setPreventCancel self val = liftDOM (void (self ^. jss "preventCancel" (toJSVal val)))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventcancel StreamPipeOptions.preventCancel specification>
getPreventCancel :: (MonadDOM m) => StreamPipeOptions -> m (Maybe Bool)
getPreventCancel self = liftDOM (((self ^. js "preventCancel") >>= fromJSValUnchecked))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventcancel StreamPipeOptions.preventCancel specification>
getPreventCancelUnsafe :: (MonadDOM m, HasCallStack) => StreamPipeOptions -> m Bool
getPreventCancelUnsafe self = liftDOM ((((self ^. js "preventCancel") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-preventcancel StreamPipeOptions.preventCancel specification>
getPreventCancelUnchecked :: (MonadDOM m) => StreamPipeOptions -> m Bool
getPreventCancelUnchecked self = liftDOM (((self ^. js "preventCancel") >>= valToBool))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-signal StreamPipeOptions.signal specification>
setSignal :: (MonadDOM m, IsAbortSignal val) => StreamPipeOptions -> val -> m ()
setSignal self val = liftDOM (void (self ^. jss "signal" (toJSVal val)))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-signal StreamPipeOptions.signal specification>
getSignal :: (MonadDOM m) => StreamPipeOptions -> m (Maybe AbortSignal)
getSignal self = liftDOM (((self ^. js "signal") >>= fromJSValUnchecked))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-signal StreamPipeOptions.signal specification>
getSignalUnsafe :: (MonadDOM m, HasCallStack) => StreamPipeOptions -> m AbortSignal
getSignalUnsafe self = liftDOM ((((self ^. js "signal") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://streams.spec.whatwg.org/#dom-streampipeoptions-signal StreamPipeOptions.signal specification>
getSignalUnchecked :: (MonadDOM m) => StreamPipeOptions -> m AbortSignal
getSignalUnchecked self = liftDOM (((self ^. js "signal") >>= fromJSValUnchecked))