ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/PaymentDetailsInit.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from payment-request (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.PaymentDetailsInit
(js_newPaymentDetailsInit, js_setId, js_getId, js_setTotal, js_getTotal, newPaymentDetailsInit, setId, getId, getIdUnsafe, getIdUnchecked, setTotal, getTotal, PaymentDetailsInit(..), gTypePaymentDetailsInit)
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 ({\"total\": $1}); })"
js_newPaymentDetailsInit :: PaymentItem -> IO PaymentDetailsInit
-- | <https://w3c.github.io/payment-request/#dom-paymentdetailsinit PaymentDetailsInit specification>
newPaymentDetailsInit :: (MonadDOM m) => PaymentItem -> m PaymentDetailsInit
newPaymentDetailsInit total = liftDOM ((js_newPaymentDetailsInit (total)))
foreign import javascript safe "(($1, $2) => { $1[\"id\"] = $2; })"
js_setId :: PaymentDetailsInit -> JSString -> IO ()
-- | <https://w3c.github.io/payment-request/#dom-paymentdetailsinit-id PaymentDetailsInit.id specification>
setId :: (MonadDOM m, ToJSString val) => PaymentDetailsInit -> val -> m ()
setId self val = liftDOM (void ((js_setId (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"id\"]; })"
js_getId :: PaymentDetailsInit -> IO JSVal
-- | <https://w3c.github.io/payment-request/#dom-paymentdetailsinit-id PaymentDetailsInit.id specification>
getId :: (MonadDOM m, FromJSString result) => PaymentDetailsInit -> m (Maybe result)
getId self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getId (self))))
-- | <https://w3c.github.io/payment-request/#dom-paymentdetailsinit-id PaymentDetailsInit.id specification>
getIdUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PaymentDetailsInit -> m result
getIdUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getId (self))) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/payment-request/#dom-paymentdetailsinit-id PaymentDetailsInit.id specification>
getIdUnchecked :: (MonadDOM m, FromJSString result) => PaymentDetailsInit -> m result
getIdUnchecked self = liftDOM ((pFromJSVal <$> (js_getId (self))))
foreign import javascript safe "(($1, $2) => { $1[\"total\"] = $2; })"
js_setTotal :: PaymentDetailsInit -> PaymentItem -> IO ()
-- | <https://w3c.github.io/payment-request/#dom-paymentdetailsinit-total PaymentDetailsInit.total specification>
setTotal :: (MonadDOM m) => PaymentDetailsInit -> PaymentItem -> m ()
setTotal self val = liftDOM (void ((js_setTotal (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"total\"]; })"
js_getTotal :: PaymentDetailsInit -> IO PaymentItem
-- | <https://w3c.github.io/payment-request/#dom-paymentdetailsinit-total PaymentDetailsInit.total specification>
getTotal :: (MonadDOM m) => PaymentDetailsInit -> m PaymentItem
getTotal self = liftDOM ((js_getTotal (self)))