ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/GetNotificationOptions.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from notifications (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.GetNotificationOptions
(js_newGetNotificationOptions, js_setTag, js_getTag, newGetNotificationOptions, setTag, getTag, getTagUnsafe, getTagUnchecked, GetNotificationOptions(..), gTypeGetNotificationOptions)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(() => { return ({}); })"
js_newGetNotificationOptions :: IO GetNotificationOptions
-- | <https://notifications.spec.whatwg.org/#dictdef-getnotificationoptions GetNotificationOptions specification>
newGetNotificationOptions :: (MonadDOM m) => m GetNotificationOptions
newGetNotificationOptions = liftDOM ((js_newGetNotificationOptions))
foreign import javascript safe "(($1, $2) => { $1[\"tag\"] = $2; })"
js_setTag :: GetNotificationOptions -> JSString -> IO ()
-- | <https://notifications.spec.whatwg.org/#dom-getnotificationoptions-tag GetNotificationOptions.tag specification>
setTag :: (MonadDOM m, ToJSString val) => GetNotificationOptions -> val -> m ()
setTag self val = liftDOM (void ((js_setTag (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"tag\"]; })"
js_getTag :: GetNotificationOptions -> IO JSVal
-- | <https://notifications.spec.whatwg.org/#dom-getnotificationoptions-tag GetNotificationOptions.tag specification>
getTag :: (MonadDOM m, FromJSString result) => GetNotificationOptions -> m (Maybe result)
getTag self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getTag (self))))
-- | <https://notifications.spec.whatwg.org/#dom-getnotificationoptions-tag GetNotificationOptions.tag specification>
getTagUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => GetNotificationOptions -> m result
getTagUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getTag (self))) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://notifications.spec.whatwg.org/#dom-getnotificationoptions-tag GetNotificationOptions.tag specification>
getTagUnchecked :: (MonadDOM m, FromJSString result) => GetNotificationOptions -> m result
getTagUnchecked self = liftDOM ((pFromJSVal <$> (js_getTag (self))))