ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/Point2D.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from image-capture (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.Point2D
(js_newPoint2D, js_setX, js_getX, js_setY, js_getY, newPoint2D, setX, getX, getXUnsafe, getXUnchecked, setY, getY, getYUnsafe, getYUnchecked, Point2D(..), gTypePoint2D)
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 "(() => { return ({}); })"
js_newPoint2D :: IO Point2D
-- | <https://w3c.github.io/mediacapture-image/#dictdef-point2d Point2D specification>
newPoint2D :: (MonadDOM m) => m Point2D
newPoint2D = liftDOM ((js_newPoint2D))
foreign import javascript safe "(($1, $2) => { $1[\"x\"] = $2; })"
js_setX :: Point2D -> Double -> IO ()
-- | <https://w3c.github.io/mediacapture-image/#dom-point2d-x Point2D.x specification>
setX :: (MonadDOM m) => Point2D -> Double -> m ()
setX self val = liftDOM (void ((js_setX (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"x\"]; })"
js_getX :: Point2D -> IO JSVal
-- | <https://w3c.github.io/mediacapture-image/#dom-point2d-x Point2D.x specification>
getX :: (MonadDOM m) => Point2D -> m (Maybe Double)
getX self = liftDOM (((js_getX (self)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/mediacapture-image/#dom-point2d-x Point2D.x specification>
getXUnsafe :: (MonadDOM m, HasCallStack) => Point2D -> m Double
getXUnsafe self = liftDOM ((((js_getX (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/mediacapture-image/#dom-point2d-x Point2D.x specification>
getXUnchecked :: (MonadDOM m) => Point2D -> m Double
getXUnchecked self = liftDOM ((pFromJSVal <$> (js_getX (self))))
foreign import javascript safe "(($1, $2) => { $1[\"y\"] = $2; })"
js_setY :: Point2D -> Double -> IO ()
-- | <https://w3c.github.io/mediacapture-image/#dom-point2d-y Point2D.y specification>
setY :: (MonadDOM m) => Point2D -> Double -> m ()
setY self val = liftDOM (void ((js_setY (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"y\"]; })"
js_getY :: Point2D -> IO JSVal
-- | <https://w3c.github.io/mediacapture-image/#dom-point2d-y Point2D.y specification>
getY :: (MonadDOM m) => Point2D -> m (Maybe Double)
getY self = liftDOM (((js_getY (self)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/mediacapture-image/#dom-point2d-y Point2D.y specification>
getYUnsafe :: (MonadDOM m, HasCallStack) => Point2D -> m Double
getYUnsafe self = liftDOM ((((js_getY (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/mediacapture-image/#dom-point2d-y Point2D.y specification>
getYUnchecked :: (MonadDOM m) => Point2D -> m Double
getYUnchecked self = liftDOM ((pFromJSVal <$> (js_getY (self))))