ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/NotificationEventInit.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.NotificationEventInit
(js_newNotificationEventInit, js_setNotification, js_getNotification, js_setAction, js_getAction, newNotificationEventInit, setNotification, getNotification, setAction, getAction, getActionUnsafe, getActionUnchecked, NotificationEventInit(..), gTypeNotificationEventInit)
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 "(($1) => { return ({\"notification\": $1}); })"
js_newNotificationEventInit :: Notification -> IO NotificationEventInit
-- | <https://notifications.spec.whatwg.org/#dictdef-notificationeventinit NotificationEventInit specification>
newNotificationEventInit :: (MonadDOM m) => Notification -> m NotificationEventInit
newNotificationEventInit notification = liftDOM ((js_newNotificationEventInit (notification)))
foreign import javascript safe "(($1, $2) => { $1[\"notification\"] = $2; })"
js_setNotification :: NotificationEventInit -> Notification -> IO ()
-- | <https://notifications.spec.whatwg.org/#dom-notificationeventinit-notification NotificationEventInit.notification specification>
setNotification :: (MonadDOM m) => NotificationEventInit -> Notification -> m ()
setNotification self val = liftDOM (void ((js_setNotification (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"notification\"]; })"
js_getNotification :: NotificationEventInit -> IO Notification
-- | <https://notifications.spec.whatwg.org/#dom-notificationeventinit-notification NotificationEventInit.notification specification>
getNotification :: (MonadDOM m) => NotificationEventInit -> m Notification
getNotification self = liftDOM ((js_getNotification (self)))
foreign import javascript safe "(($1, $2) => { $1[\"action\"] = $2; })"
js_setAction :: NotificationEventInit -> JSString -> IO ()
-- | <https://notifications.spec.whatwg.org/#dom-notificationeventinit-action NotificationEventInit.action specification>
setAction :: (MonadDOM m, ToJSString val) => NotificationEventInit -> val -> m ()
setAction self val = liftDOM (void ((js_setAction (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"action\"]; })"
js_getAction :: NotificationEventInit -> IO JSVal
-- | <https://notifications.spec.whatwg.org/#dom-notificationeventinit-action NotificationEventInit.action specification>
getAction :: (MonadDOM m, FromJSString result) => NotificationEventInit -> m (Maybe result)
getAction self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getAction (self))))
-- | <https://notifications.spec.whatwg.org/#dom-notificationeventinit-action NotificationEventInit.action specification>
getActionUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => NotificationEventInit -> m result
getActionUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getAction (self))) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://notifications.spec.whatwg.org/#dom-notificationeventinit-action NotificationEventInit.action specification>
getActionUnchecked :: (MonadDOM m, FromJSString result) => NotificationEventInit -> m result
getActionUnchecked self = liftDOM ((pFromJSVal <$> (js_getAction (self))))