{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.StorageEvent
(newStorageEvent, initStorageEvent, getKey, getKeyUnsafe,
getKeyUnchecked, getOldValue, getOldValueUnsafe,
getOldValueUnchecked, getNewValue, getNewValueUnsafe,
getNewValueUnchecked, getUrl, getStorageArea, getStorageAreaUnsafe,
getStorageAreaUnchecked, StorageEvent(..), gTypeStorageEvent)
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
newStorageEvent ::
(MonadDOM m, ToJSString type') =>
type' -> Maybe StorageEventInit -> m StorageEvent
newStorageEvent type' eventInitDict
= liftDOM
(StorageEvent <$>
new (jsg "StorageEvent") [toJSVal type', toJSVal eventInitDict])
initStorageEvent ::
(MonadDOM m, ToJSString typeArg, ToJSString keyArg,
ToJSString oldValueArg, ToJSString newValueArg,
ToJSString urlArg) =>
StorageEvent ->
Maybe typeArg ->
Bool ->
Bool ->
Maybe keyArg ->
Maybe oldValueArg ->
Maybe newValueArg -> Maybe urlArg -> Maybe Storage -> m ()
initStorageEvent self typeArg canBubbleArg cancelableArg keyArg
oldValueArg newValueArg urlArg storageAreaArg
= liftDOM
(void
(self ^. jsf "initStorageEvent"
[toJSVal typeArg, toJSVal canBubbleArg, toJSVal cancelableArg,
toJSVal keyArg, toJSVal oldValueArg, toJSVal newValueArg,
toJSVal urlArg, toJSVal storageAreaArg]))
getKey ::
(MonadDOM m, FromJSString result) =>
StorageEvent -> m (Maybe result)
getKey self = liftDOM ((self ^. js "key") >>= fromMaybeJSString)
getKeyUnsafe ::
(MonadDOM m, HasCallStack, FromJSString result) =>
StorageEvent -> m result
getKeyUnsafe self
= liftDOM
(((self ^. js "key") >>= fromMaybeJSString) >>=
maybe (Prelude.error "Nothing to return") return)
getKeyUnchecked ::
(MonadDOM m, FromJSString result) => StorageEvent -> m result
getKeyUnchecked self
= liftDOM ((self ^. js "key") >>= fromJSValUnchecked)
getOldValue ::
(MonadDOM m, FromJSString result) =>
StorageEvent -> m (Maybe result)
getOldValue self
= liftDOM ((self ^. js "oldValue") >>= fromMaybeJSString)
getOldValueUnsafe ::
(MonadDOM m, HasCallStack, FromJSString result) =>
StorageEvent -> m result
getOldValueUnsafe self
= liftDOM
(((self ^. js "oldValue") >>= fromMaybeJSString) >>=
maybe (Prelude.error "Nothing to return") return)
getOldValueUnchecked ::
(MonadDOM m, FromJSString result) => StorageEvent -> m result
getOldValueUnchecked self
= liftDOM ((self ^. js "oldValue") >>= fromJSValUnchecked)
getNewValue ::
(MonadDOM m, FromJSString result) =>
StorageEvent -> m (Maybe result)
getNewValue self
= liftDOM ((self ^. js "newValue") >>= fromMaybeJSString)
getNewValueUnsafe ::
(MonadDOM m, HasCallStack, FromJSString result) =>
StorageEvent -> m result
getNewValueUnsafe self
= liftDOM
(((self ^. js "newValue") >>= fromMaybeJSString) >>=
maybe (Prelude.error "Nothing to return") return)
getNewValueUnchecked ::
(MonadDOM m, FromJSString result) => StorageEvent -> m result
getNewValueUnchecked self
= liftDOM ((self ^. js "newValue") >>= fromJSValUnchecked)
getUrl ::
(MonadDOM m, FromJSString result) => StorageEvent -> m result
getUrl self = liftDOM ((self ^. js "url") >>= fromJSValUnchecked)
getStorageArea :: (MonadDOM m) => StorageEvent -> m (Maybe Storage)
getStorageArea self
= liftDOM ((self ^. js "storageArea") >>= fromJSVal)
getStorageAreaUnsafe ::
(MonadDOM m, HasCallStack) => StorageEvent -> m Storage
getStorageAreaUnsafe self
= liftDOM
(((self ^. js "storageArea") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getStorageAreaUnchecked ::
(MonadDOM m) => StorageEvent -> m Storage
getStorageAreaUnchecked self
= liftDOM ((self ^. js "storageArea") >>= fromJSValUnchecked)