packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from encoding (webref). Do not edit.
module JSDOM.Generated.TextEncoderEncodeIntoResult
       (newTextEncoderEncodeIntoResult, setRead, getRead, getReadUnsafe, getReadUnchecked, setWritten, getWritten, getWrittenUnsafe, getWrittenUnchecked, TextEncoderEncodeIntoResult(..), gTypeTextEncoderEncodeIntoResult)
       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://encoding.spec.whatwg.org/#dictdef-textencoderencodeintoresult TextEncoderEncodeIntoResult specification>
newTextEncoderEncodeIntoResult :: (MonadDOM m) => m TextEncoderEncodeIntoResult
newTextEncoderEncodeIntoResult = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://encoding.spec.whatwg.org/#dom-textencoderencodeintoresult-read TextEncoderEncodeIntoResult.read specification>
setRead :: (MonadDOM m) => TextEncoderEncodeIntoResult -> Word53 -> m ()
setRead self val = liftDOM (void (self ^. jss "read" (toJSVal val)))

-- | <https://encoding.spec.whatwg.org/#dom-textencoderencodeintoresult-read TextEncoderEncodeIntoResult.read specification>
getRead :: (MonadDOM m) => TextEncoderEncodeIntoResult -> m (Maybe Word53)
getRead self = liftDOM (((self ^. js "read") >>= fromJSValUnchecked))

-- | <https://encoding.spec.whatwg.org/#dom-textencoderencodeintoresult-read TextEncoderEncodeIntoResult.read specification>
getReadUnsafe :: (MonadDOM m, HasCallStack) => TextEncoderEncodeIntoResult -> m Word53
getReadUnsafe self = liftDOM ((((self ^. js "read") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://encoding.spec.whatwg.org/#dom-textencoderencodeintoresult-read TextEncoderEncodeIntoResult.read specification>
getReadUnchecked :: (MonadDOM m) => TextEncoderEncodeIntoResult -> m Word53
getReadUnchecked self = liftDOM (((self ^. js "read") >>= fromJSValUnchecked))

-- | <https://encoding.spec.whatwg.org/#dom-textencoderencodeintoresult-written TextEncoderEncodeIntoResult.written specification>
setWritten :: (MonadDOM m) => TextEncoderEncodeIntoResult -> Word53 -> m ()
setWritten self val = liftDOM (void (self ^. jss "written" (toJSVal val)))

-- | <https://encoding.spec.whatwg.org/#dom-textencoderencodeintoresult-written TextEncoderEncodeIntoResult.written specification>
getWritten :: (MonadDOM m) => TextEncoderEncodeIntoResult -> m (Maybe Word53)
getWritten self = liftDOM (((self ^. js "written") >>= fromJSValUnchecked))

-- | <https://encoding.spec.whatwg.org/#dom-textencoderencodeintoresult-written TextEncoderEncodeIntoResult.written specification>
getWrittenUnsafe :: (MonadDOM m, HasCallStack) => TextEncoderEncodeIntoResult -> m Word53
getWrittenUnsafe self = liftDOM ((((self ^. js "written") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://encoding.spec.whatwg.org/#dom-textencoderencodeintoresult-written TextEncoderEncodeIntoResult.written specification>
getWrittenUnchecked :: (MonadDOM m) => TextEncoderEncodeIntoResult -> m Word53
getWrittenUnchecked self = liftDOM (((self ^. js "written") >>= fromJSValUnchecked))