packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/Client.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from service-workers (webref). Do not edit.
module JSDOM.Generated.Client
       (postMessage, postMessageOptions, getUrl, getFrameType, getId, getType, Client(..), gTypeClient, IsClient, toClient)
       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://developer.mozilla.org/docs/Web/API/Client/postMessage MDN Client.postMessage documentation>
postMessage :: (MonadDOM m, IsClient self) => self -> JSVal -> [GObject] -> m ()
postMessage self message transfer = liftDOM (void ((Types.toClient self) ^. jsf "postMessage" [toJSVal message, toJSVal transfer]))

-- | <https://developer.mozilla.org/docs/Web/API/Client/postMessage MDN Client.postMessage documentation>
postMessageOptions :: (MonadDOM m, IsClient self, IsStructuredSerializeOptions options) => self -> JSVal -> Maybe options -> m ()
postMessageOptions self message options = liftDOM (void ((Types.toClient self) ^. jsf "postMessage" [toJSVal message, P.maybe (P.return jsUndefined) toJSVal options]))

-- | <https://developer.mozilla.org/docs/Web/API/Client/url MDN Client.url documentation>
getUrl :: (MonadDOM m, IsClient self, FromJSString result) => self -> m result
getUrl self = liftDOM ((((Types.toClient self) ^. js "url") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/Client/frameType MDN Client.frameType documentation>
getFrameType :: (MonadDOM m, IsClient self) => self -> m FrameType
getFrameType self = liftDOM ((((Types.toClient self) ^. js "frameType") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/Client/id MDN Client.id documentation>
getId :: (MonadDOM m, IsClient self, FromJSString result) => self -> m result
getId self = liftDOM ((((Types.toClient self) ^. js "id") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/Client/type MDN Client.type documentation>
getType :: (MonadDOM m, IsClient self) => self -> m ClientType
getType self = liftDOM ((((Types.toClient self) ^. js "type") >>= fromJSValUnchecked))