packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from payment-request (webref). Do not edit.
module JSDOM.Generated.PaymentCurrencyAmount
       (newPaymentCurrencyAmount, setCurrency, getCurrency, setValue, getValue, PaymentCurrencyAmount(..), gTypePaymentCurrencyAmount)
       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://w3c.github.io/payment-request/#dom-paymentcurrencyamount PaymentCurrencyAmount specification>
newPaymentCurrencyAmount :: (MonadDOM m, ToJSString currency, ToJSString value) => currency -> value -> m PaymentCurrencyAmount
newPaymentCurrencyAmount currency value = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "currency" (toJSVal currency)) P.>> (o ^. jss "value" (toJSVal value)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentcurrencyamount-currency PaymentCurrencyAmount.currency specification>
setCurrency :: (MonadDOM m, ToJSString val) => PaymentCurrencyAmount -> val -> m ()
setCurrency self val = liftDOM (void (self ^. jss "currency" (toJSVal val)))

-- | <https://w3c.github.io/payment-request/#dom-paymentcurrencyamount-currency PaymentCurrencyAmount.currency specification>
getCurrency :: (MonadDOM m, FromJSString result) => PaymentCurrencyAmount -> m result
getCurrency self = liftDOM (((self ^. js "currency") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentcurrencyamount-value PaymentCurrencyAmount.value specification>
setValue :: (MonadDOM m, ToJSString val) => PaymentCurrencyAmount -> val -> m ()
setValue self val = liftDOM (void (self ^. jss "value" (toJSVal val)))

-- | <https://w3c.github.io/payment-request/#dom-paymentcurrencyamount-value PaymentCurrencyAmount.value specification>
getValue :: (MonadDOM m, FromJSString result) => PaymentCurrencyAmount -> m result
getValue self = liftDOM (((self ^. js "value") >>= fromJSValUnchecked))