jsaddle-dom-0.10.0.0: src/JSDOM/Generated/FileSystemGetFileOptions.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.FileSystemGetFileOptions
(newFileSystemGetFileOptions, setCreate, getCreate, getCreateUnsafe, getCreateUnchecked, FileSystemGetFileOptions(..), gTypeFileSystemGetFileOptions)
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-filesystemgetfileoptions FileSystemGetFileOptions specification>
newFileSystemGetFileOptions :: (MonadDOM m) => m FileSystemGetFileOptions
newFileSystemGetFileOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://fs.spec.whatwg.org/#dom-filesystemgetfileoptions-create FileSystemGetFileOptions.create specification>
setCreate :: (MonadDOM m) => FileSystemGetFileOptions -> Bool -> m ()
setCreate self val = liftDOM (void (self ^. jss "create" (toJSVal val)))
-- | <https://fs.spec.whatwg.org/#dom-filesystemgetfileoptions-create FileSystemGetFileOptions.create specification>
getCreate :: (MonadDOM m) => FileSystemGetFileOptions -> m (Maybe Bool)
getCreate self = liftDOM (((self ^. js "create") >>= fromJSValUnchecked))
-- | <https://fs.spec.whatwg.org/#dom-filesystemgetfileoptions-create FileSystemGetFileOptions.create specification>
getCreateUnsafe :: (MonadDOM m, HasCallStack) => FileSystemGetFileOptions -> m Bool
getCreateUnsafe self = liftDOM ((((self ^. js "create") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://fs.spec.whatwg.org/#dom-filesystemgetfileoptions-create FileSystemGetFileOptions.create specification>
getCreateUnchecked :: (MonadDOM m) => FileSystemGetFileOptions -> m Bool
getCreateUnchecked self = liftDOM (((self ^. js "create") >>= valToBool))