{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.DataTransferItem
(getAsString, getAsFile, getAsFile_, getAsFileUnsafe,
getAsFileUnchecked, getKind, getType, DataTransferItem(..),
gTypeDataTransferItem)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
getAsString ::
(MonadDOM m, ToJSString callback) =>
DataTransferItem -> Maybe (StringCallback callback) -> m ()
getAsString self callback
= liftDOM (void (self ^. jsf "getAsString" [toJSVal callback]))
getAsFile :: (MonadDOM m) => DataTransferItem -> m (Maybe Blob)
getAsFile self
= liftDOM ((self ^. jsf "getAsFile" ()) >>= fromJSVal)
getAsFile_ :: (MonadDOM m) => DataTransferItem -> m ()
getAsFile_ self = liftDOM (void (self ^. jsf "getAsFile" ()))
getAsFileUnsafe ::
(MonadDOM m, HasCallStack) => DataTransferItem -> m Blob
getAsFileUnsafe self
= liftDOM
(((self ^. jsf "getAsFile" ()) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getAsFileUnchecked :: (MonadDOM m) => DataTransferItem -> m Blob
getAsFileUnchecked self
= liftDOM ((self ^. jsf "getAsFile" ()) >>= fromJSValUnchecked)
getKind ::
(MonadDOM m, FromJSString result) => DataTransferItem -> m result
getKind self = liftDOM ((self ^. js "kind") >>= fromJSValUnchecked)
getType ::
(MonadDOM m, FromJSString result) => DataTransferItem -> m result
getType self = liftDOM ((self ^. js "type") >>= fromJSValUnchecked)