ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/BlobPropertyBag.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from FileAPI (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.BlobPropertyBag
(js_newBlobPropertyBag, js_setType, js_getType, js_setEndings, js_getEndings, 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 GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(() => { return ({}); })"
js_newBlobPropertyBag :: IO BlobPropertyBag
-- | <https://w3c.github.io/FileAPI/#dfn-BlobPropertyBag BlobPropertyBag specification>
newBlobPropertyBag :: (MonadDOM m) => m BlobPropertyBag
newBlobPropertyBag = liftDOM ((js_newBlobPropertyBag))
foreign import javascript safe "(($1, $2) => { $1[\"type\"] = $2; })"
js_setType :: BlobPropertyBag -> JSString -> IO ()
-- | <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 ((js_setType ((Types.toBlobPropertyBag self)) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"type\"]; })"
js_getType :: BlobPropertyBag -> IO JSVal
-- | <https://w3c.github.io/FileAPI/#dfn-BPtype BlobPropertyBag.type specification>
getType :: (MonadDOM m, IsBlobPropertyBag self, FromJSString result) => self -> m (Maybe result)
getType self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getType ((Types.toBlobPropertyBag self)))))
-- | <https://w3c.github.io/FileAPI/#dfn-BPtype BlobPropertyBag.type specification>
getTypeUnsafe :: (MonadDOM m, IsBlobPropertyBag self, HasCallStack, FromJSString result) => self -> m result
getTypeUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getType ((Types.toBlobPropertyBag self)))) >>= 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 ((pFromJSVal <$> (js_getType ((Types.toBlobPropertyBag self)))))
foreign import javascript safe "(($1, $2) => { $1[\"endings\"] = $2; })"
js_setEndings :: BlobPropertyBag -> JSVal -> IO ()
-- | <https://w3c.github.io/FileAPI/#dom-blobpropertybag-endings BlobPropertyBag.endings specification>
setEndings :: (MonadDOM m, IsBlobPropertyBag self) => self -> EndingType -> m ()
setEndings self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setEndings ((Types.toBlobPropertyBag self)) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"endings\"]; })"
js_getEndings :: BlobPropertyBag -> IO JSVal
-- | <https://w3c.github.io/FileAPI/#dom-blobpropertybag-endings BlobPropertyBag.endings specification>
getEndings :: (MonadDOM m, IsBlobPropertyBag self) => self -> m (Maybe EndingType)
getEndings self = liftDOM (((js_getEndings ((Types.toBlobPropertyBag self))) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/FileAPI/#dom-blobpropertybag-endings BlobPropertyBag.endings specification>
getEndingsUnsafe :: (MonadDOM m, IsBlobPropertyBag self, HasCallStack) => self -> m EndingType
getEndingsUnsafe self = liftDOM ((((js_getEndings ((Types.toBlobPropertyBag self))) >>= 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 ((pFromJSVal <$> (js_getEndings ((Types.toBlobPropertyBag self)))))