jsaddle-dom-0.10.0.0: src/JSDOM/Generated/BlobPropertyBag.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from FileAPI (webref). Do not edit.
module JSDOM.Generated.BlobPropertyBag
(newBlobPropertyBag, setType, getType, getTypeUnsafe, getTypeUnchecked, setEndings, getEndings, getEndingsUnsafe, getEndingsUnchecked, BlobPropertyBag(..), gTypeBlobPropertyBag, IsBlobPropertyBag, toBlobPropertyBag)
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://w3c.github.io/FileAPI/#dfn-BlobPropertyBag BlobPropertyBag specification>
newBlobPropertyBag :: (MonadDOM m) => m BlobPropertyBag
newBlobPropertyBag = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/FileAPI/#dfn-BPtype BlobPropertyBag.type specification>
setType :: (MonadDOM m, IsBlobPropertyBag self, ToJSString val) => self -> val -> m ()
setType self val = liftDOM (void ((Types.toBlobPropertyBag self) ^. jss "type" (toJSVal val)))
-- | <https://w3c.github.io/FileAPI/#dfn-BPtype BlobPropertyBag.type specification>
getType :: (MonadDOM m, IsBlobPropertyBag self, FromJSString result) => self -> m (Maybe result)
getType self = liftDOM ((((Types.toBlobPropertyBag self) ^. js "type") >>= fromMaybeJSString))
-- | <https://w3c.github.io/FileAPI/#dfn-BPtype BlobPropertyBag.type specification>
getTypeUnsafe :: (MonadDOM m, IsBlobPropertyBag self, HasCallStack, FromJSString result) => self -> m result
getTypeUnsafe self = liftDOM (((((Types.toBlobPropertyBag self) ^. js "type") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/FileAPI/#dfn-BPtype BlobPropertyBag.type specification>
getTypeUnchecked :: (MonadDOM m, IsBlobPropertyBag self, FromJSString result) => self -> m result
getTypeUnchecked self = liftDOM ((((Types.toBlobPropertyBag self) ^. js "type") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/FileAPI/#dom-blobpropertybag-endings BlobPropertyBag.endings specification>
setEndings :: (MonadDOM m, IsBlobPropertyBag self) => self -> EndingType -> m ()
setEndings self val = liftDOM (void ((Types.toBlobPropertyBag self) ^. jss "endings" (toJSVal val)))
-- | <https://w3c.github.io/FileAPI/#dom-blobpropertybag-endings BlobPropertyBag.endings specification>
getEndings :: (MonadDOM m, IsBlobPropertyBag self) => self -> m (Maybe EndingType)
getEndings self = liftDOM ((((Types.toBlobPropertyBag self) ^. js "endings") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/FileAPI/#dom-blobpropertybag-endings BlobPropertyBag.endings specification>
getEndingsUnsafe :: (MonadDOM m, IsBlobPropertyBag self, HasCallStack) => self -> m EndingType
getEndingsUnsafe self = liftDOM (((((Types.toBlobPropertyBag self) ^. js "endings") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/FileAPI/#dom-blobpropertybag-endings BlobPropertyBag.endings specification>
getEndingsUnchecked :: (MonadDOM m, IsBlobPropertyBag self) => self -> m EndingType
getEndingsUnchecked self = liftDOM ((((Types.toBlobPropertyBag self) ^. js "endings") >>= fromJSValUnchecked))