jsaddle-dom-0.10.0.0: src/JSDOM/Generated/FileSystemCreateWritableOptions.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from fs (webref). Do not edit.
module JSDOM.Generated.FileSystemCreateWritableOptions
(newFileSystemCreateWritableOptions, setKeepExistingData, getKeepExistingData, getKeepExistingDataUnsafe, getKeepExistingDataUnchecked, FileSystemCreateWritableOptions(..), gTypeFileSystemCreateWritableOptions)
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://fs.spec.whatwg.org/#dictdef-filesystemcreatewritableoptions FileSystemCreateWritableOptions specification>
newFileSystemCreateWritableOptions :: (MonadDOM m) => m FileSystemCreateWritableOptions
newFileSystemCreateWritableOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://fs.spec.whatwg.org/#dom-filesystemcreatewritableoptions-keepexistingdata FileSystemCreateWritableOptions.keepExistingData specification>
setKeepExistingData :: (MonadDOM m) => FileSystemCreateWritableOptions -> Bool -> m ()
setKeepExistingData self val = liftDOM (void (self ^. jss "keepExistingData" (toJSVal val)))
-- | <https://fs.spec.whatwg.org/#dom-filesystemcreatewritableoptions-keepexistingdata FileSystemCreateWritableOptions.keepExistingData specification>
getKeepExistingData :: (MonadDOM m) => FileSystemCreateWritableOptions -> m (Maybe Bool)
getKeepExistingData self = liftDOM (((self ^. js "keepExistingData") >>= fromJSValUnchecked))
-- | <https://fs.spec.whatwg.org/#dom-filesystemcreatewritableoptions-keepexistingdata FileSystemCreateWritableOptions.keepExistingData specification>
getKeepExistingDataUnsafe :: (MonadDOM m, HasCallStack) => FileSystemCreateWritableOptions -> m Bool
getKeepExistingDataUnsafe self = liftDOM ((((self ^. js "keepExistingData") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://fs.spec.whatwg.org/#dom-filesystemcreatewritableoptions-keepexistingdata FileSystemCreateWritableOptions.keepExistingData specification>
getKeepExistingDataUnchecked :: (MonadDOM m) => FileSystemCreateWritableOptions -> m Bool
getKeepExistingDataUnchecked self = liftDOM (((self ^. js "keepExistingData") >>= valToBool))