{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.DOMPoint
(newDOMPoint, newDOMPoint', fromPoint, fromPoint_, setX, getX,
setY, getY, setZ, getZ, setW, getW, DOMPoint(..), gTypeDOMPoint)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
newDOMPoint :: (MonadDOM m) => DOMPointInit -> m DOMPoint
newDOMPoint :: forall (m :: * -> *). MonadDOM m => DOMPointInit -> m DOMPoint
newDOMPoint DOMPointInit
point
= DOM DOMPoint -> m DOMPoint
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSVal -> DOMPoint
DOMPoint (JSVal -> DOMPoint) -> JSM JSVal -> DOM DOMPoint
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> JSM JSVal -> [JSM JSVal] -> JSM JSVal
forall constructor args.
(MakeObject constructor, MakeArgs args) =>
constructor -> args -> JSM JSVal
new (String -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg String
"DOMPoint") [DOMPointInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal DOMPointInit
point])
newDOMPoint' ::
(MonadDOM m) =>
Maybe Double ->
Maybe Double -> Maybe Double -> Maybe Double -> m DOMPoint
newDOMPoint' :: forall (m :: * -> *).
MonadDOM m =>
Maybe Double
-> Maybe Double -> Maybe Double -> Maybe Double -> m DOMPoint
newDOMPoint' Maybe Double
x Maybe Double
y Maybe Double
z Maybe Double
w
= DOM DOMPoint -> m DOMPoint
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSVal -> DOMPoint
DOMPoint (JSVal -> DOMPoint) -> JSM JSVal -> DOM DOMPoint
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
JSM JSVal -> [JSM JSVal] -> JSM JSVal
forall constructor args.
(MakeObject constructor, MakeArgs args) =>
constructor -> args -> JSM JSVal
new (String -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg String
"DOMPoint") [Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
x, Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
y, Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
z, Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
w])
fromPoint :: (MonadDOM m) => Maybe DOMPointInit -> m DOMPoint
fromPoint :: forall (m :: * -> *).
MonadDOM m =>
Maybe DOMPointInit -> m DOMPoint
fromPoint Maybe DOMPointInit
other
= DOM DOMPoint -> m DOMPoint
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((String -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg String
"DOMPoint") JSM JSVal
-> Getting (JSM JSVal) (JSM JSVal) (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"fromPoint" [Maybe DOMPointInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe DOMPointInit
other]) JSM JSVal -> (JSVal -> DOM DOMPoint) -> DOM DOMPoint
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
JSVal -> DOM DOMPoint
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
fromPoint_ :: (MonadDOM m) => Maybe DOMPointInit -> m ()
fromPoint_ :: forall (m :: * -> *). MonadDOM m => Maybe DOMPointInit -> m ()
fromPoint_ Maybe DOMPointInit
other
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ((String -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg String
"DOMPoint") JSM JSVal
-> Getting (JSM JSVal) (JSM JSVal) (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"fromPoint" [Maybe DOMPointInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe DOMPointInit
other]))
setX :: (MonadDOM m) => DOMPoint -> Double -> m ()
setX :: forall (m :: * -> *). MonadDOM m => DOMPoint -> Double -> m ()
setX DOMPoint
self Double
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (DOMPoint
self DOMPoint -> Getting (DOM ()) DOMPoint (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"x" (Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Double
val))
getX :: (MonadDOM m) => DOMPoint -> m Double
getX :: forall (m :: * -> *). MonadDOM m => DOMPoint -> m Double
getX DOMPoint
self = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DOMPoint
self DOMPoint -> Getting (JSM JSVal) DOMPoint (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DOMPoint (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"x") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)
setY :: (MonadDOM m) => DOMPoint -> Double -> m ()
setY :: forall (m :: * -> *). MonadDOM m => DOMPoint -> Double -> m ()
setY DOMPoint
self Double
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (DOMPoint
self DOMPoint -> Getting (DOM ()) DOMPoint (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"y" (Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Double
val))
getY :: (MonadDOM m) => DOMPoint -> m Double
getY :: forall (m :: * -> *). MonadDOM m => DOMPoint -> m Double
getY DOMPoint
self = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DOMPoint
self DOMPoint -> Getting (JSM JSVal) DOMPoint (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DOMPoint (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"y") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)
setZ :: (MonadDOM m) => DOMPoint -> Double -> m ()
setZ :: forall (m :: * -> *). MonadDOM m => DOMPoint -> Double -> m ()
setZ DOMPoint
self Double
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (DOMPoint
self DOMPoint -> Getting (DOM ()) DOMPoint (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"z" (Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Double
val))
getZ :: (MonadDOM m) => DOMPoint -> m Double
getZ :: forall (m :: * -> *). MonadDOM m => DOMPoint -> m Double
getZ DOMPoint
self = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DOMPoint
self DOMPoint -> Getting (JSM JSVal) DOMPoint (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DOMPoint (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"z") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)
setW :: (MonadDOM m) => DOMPoint -> Double -> m ()
setW :: forall (m :: * -> *). MonadDOM m => DOMPoint -> Double -> m ()
setW DOMPoint
self Double
val = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (DOMPoint
self DOMPoint -> Getting (DOM ()) DOMPoint (DOM ()) -> DOM ()
forall s a. s -> Getting a s a -> a
^. String
-> JSM JSVal
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
forall name val.
(ToJSString name, ToJSVal val) =>
name
-> val
-> forall o. MakeObject o => IndexPreservingGetter o (DOM ())
jss String
"w" (Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Double
val))
getW :: (MonadDOM m) => DOMPoint -> m Double
getW :: forall (m :: * -> *). MonadDOM m => DOMPoint -> m Double
getW DOMPoint
self = DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DOMPoint
self DOMPoint -> Getting (JSM JSVal) DOMPoint (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DOMPoint (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"w") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall value. ToJSVal value => value -> DOM Double
valToNumber)