packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/FilePropertyBag.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.FilePropertyBag
       (newFilePropertyBag, setLastModified, getLastModified, getLastModifiedUnsafe, getLastModifiedUnchecked, FilePropertyBag(..), gTypeFilePropertyBag)
       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-FilePropertyBag FilePropertyBag specification>
newFilePropertyBag :: (MonadDOM m) => m FilePropertyBag
newFilePropertyBag = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/FileAPI/#dfn-FPdate FilePropertyBag.lastModified specification>
setLastModified :: (MonadDOM m) => FilePropertyBag -> Int53 -> m ()
setLastModified self val = liftDOM (void (self ^. jss "lastModified" (toJSVal val)))

-- | <https://w3c.github.io/FileAPI/#dfn-FPdate FilePropertyBag.lastModified specification>
getLastModified :: (MonadDOM m) => FilePropertyBag -> m (Maybe Int53)
getLastModified self = liftDOM (((self ^. js "lastModified") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/FileAPI/#dfn-FPdate FilePropertyBag.lastModified specification>
getLastModifiedUnsafe :: (MonadDOM m, HasCallStack) => FilePropertyBag -> m Int53
getLastModifiedUnsafe self = liftDOM ((((self ^. js "lastModified") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/FileAPI/#dfn-FPdate FilePropertyBag.lastModified specification>
getLastModifiedUnchecked :: (MonadDOM m) => FilePropertyBag -> m Int53
getLastModifiedUnchecked self = liftDOM (((self ^. js "lastModified") >>= fromJSValUnchecked))