{-# LANGUAGE PatternSynonyms #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.SVGLengthList
       (clear, initialize, initialize_, getItem, getItem_,
        insertItemBefore, insertItemBefore_, replaceItem, replaceItem_,
        removeItem, removeItem_, appendItem, appendItem_, getNumberOfItems,
        SVGLengthList(..), gTypeSVGLengthList)
       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

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.clear Mozilla SVGLengthList.clear documentation> 
clear :: (MonadDOM m) => SVGLengthList -> m ()
clear :: forall (m :: * -> *). MonadDOM m => SVGLengthList -> m ()
clear SVGLengthList
self = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> () -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"clear" ()))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.initialize Mozilla SVGLengthList.initialize documentation> 
initialize ::
           (MonadDOM m) => SVGLengthList -> SVGLength -> m SVGLength
initialize :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> SVGLength -> m SVGLength
initialize SVGLengthList
self SVGLength
item
  = DOM SVGLength -> m SVGLength
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      ((SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"initialize" [SVGLength -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SVGLength
item]) JSM JSVal -> (JSVal -> DOM SVGLength) -> DOM SVGLength
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 SVGLength
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.initialize Mozilla SVGLengthList.initialize documentation> 
initialize_ :: (MonadDOM m) => SVGLengthList -> SVGLength -> m ()
initialize_ :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> SVGLength -> m ()
initialize_ SVGLengthList
self SVGLength
item
  = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"initialize" [SVGLength -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SVGLength
item]))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.getItem Mozilla SVGLengthList.getItem documentation> 
getItem :: (MonadDOM m) => SVGLengthList -> Word -> m SVGLength
getItem :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> Word -> m SVGLength
getItem SVGLengthList
self Word
index
  = DOM SVGLength -> m SVGLength
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      ((SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"getItem" [Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]) JSM JSVal -> (JSVal -> DOM SVGLength) -> DOM SVGLength
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 SVGLength
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.getItem Mozilla SVGLengthList.getItem documentation> 
getItem_ :: (MonadDOM m) => SVGLengthList -> Word -> m ()
getItem_ :: forall (m :: * -> *). MonadDOM m => SVGLengthList -> Word -> m ()
getItem_ SVGLengthList
self Word
index
  = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"getItem" [Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.insertItemBefore Mozilla SVGLengthList.insertItemBefore documentation> 
insertItemBefore ::
                 (MonadDOM m) => SVGLengthList -> SVGLength -> Word -> m SVGLength
insertItemBefore :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> SVGLength -> Word -> m SVGLength
insertItemBefore SVGLengthList
self SVGLength
item Word
index
  = DOM SVGLength -> m SVGLength
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      ((SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"insertItemBefore" [SVGLength -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SVGLength
item, Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]) JSM JSVal -> (JSVal -> DOM SVGLength) -> DOM SVGLength
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 SVGLength
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.insertItemBefore Mozilla SVGLengthList.insertItemBefore documentation> 
insertItemBefore_ ::
                  (MonadDOM m) => SVGLengthList -> SVGLength -> Word -> m ()
insertItemBefore_ :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> SVGLength -> Word -> m ()
insertItemBefore_ SVGLengthList
self SVGLength
item Word
index
  = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
         (SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"insertItemBefore" [SVGLength -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SVGLength
item, Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.replaceItem Mozilla SVGLengthList.replaceItem documentation> 
replaceItem ::
            (MonadDOM m) => SVGLengthList -> SVGLength -> Word -> m SVGLength
replaceItem :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> SVGLength -> Word -> m SVGLength
replaceItem SVGLengthList
self SVGLength
item Word
index
  = DOM SVGLength -> m SVGLength
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      ((SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"replaceItem" [SVGLength -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SVGLength
item, Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]) JSM JSVal -> (JSVal -> DOM SVGLength) -> DOM SVGLength
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 SVGLength
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.replaceItem Mozilla SVGLengthList.replaceItem documentation> 
replaceItem_ ::
             (MonadDOM m) => SVGLengthList -> SVGLength -> Word -> m ()
replaceItem_ :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> SVGLength -> Word -> m ()
replaceItem_ SVGLengthList
self SVGLength
item Word
index
  = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"replaceItem" [SVGLength -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SVGLength
item, Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.removeItem Mozilla SVGLengthList.removeItem documentation> 
removeItem :: (MonadDOM m) => SVGLengthList -> Word -> m SVGLength
removeItem :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> Word -> m SVGLength
removeItem SVGLengthList
self Word
index
  = DOM SVGLength -> m SVGLength
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      ((SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"removeItem" [Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]) JSM JSVal -> (JSVal -> DOM SVGLength) -> DOM SVGLength
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 SVGLength
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.removeItem Mozilla SVGLengthList.removeItem documentation> 
removeItem_ :: (MonadDOM m) => SVGLengthList -> Word -> m ()
removeItem_ :: forall (m :: * -> *). MonadDOM m => SVGLengthList -> Word -> m ()
removeItem_ SVGLengthList
self Word
index
  = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"removeItem" [Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.appendItem Mozilla SVGLengthList.appendItem documentation> 
appendItem ::
           (MonadDOM m) => SVGLengthList -> SVGLength -> m SVGLength
appendItem :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> SVGLength -> m SVGLength
appendItem SVGLengthList
self SVGLength
item
  = DOM SVGLength -> m SVGLength
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      ((SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"appendItem" [SVGLength -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SVGLength
item]) JSM JSVal -> (JSVal -> DOM SVGLength) -> DOM SVGLength
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 SVGLength
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.appendItem Mozilla SVGLengthList.appendItem documentation> 
appendItem_ :: (MonadDOM m) => SVGLengthList -> SVGLength -> m ()
appendItem_ :: forall (m :: * -> *).
MonadDOM m =>
SVGLengthList -> SVGLength -> m ()
appendItem_ SVGLengthList
self SVGLength
item
  = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (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
"appendItem" [SVGLength -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal SVGLength
item]))

-- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGLengthList.numberOfItems Mozilla SVGLengthList.numberOfItems documentation> 
getNumberOfItems :: (MonadDOM m) => SVGLengthList -> m Word
getNumberOfItems :: forall (m :: * -> *). MonadDOM m => SVGLengthList -> m Word
getNumberOfItems SVGLengthList
self
  = DOM Word -> m Word
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (Double -> Word
forall b. Integral b => Double -> b
forall a b. (RealFrac a, Integral b) => a -> b
round (Double -> Word) -> JSM Double -> DOM Word
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ((SVGLengthList
self SVGLengthList
-> Getting (JSM JSVal) SVGLengthList (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter SVGLengthList (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"numberOfItems") JSM JSVal -> (JSVal -> JSM Double) -> JSM 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 -> JSM Double
forall value. ToJSVal value => value -> JSM Double
valToNumber))