{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.StyleSheetList
(item, item_, itemUnsafe, itemUnchecked, get, get_, getLength,
StyleSheetList(..), gTypeStyleSheetList)
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
item ::
(MonadDOM m) => StyleSheetList -> Word -> m (Maybe StyleSheet)
item :: forall (m :: * -> *).
MonadDOM m =>
StyleSheetList -> Word -> m (Maybe StyleSheet)
item StyleSheetList
self Word
index
= DOM (Maybe StyleSheet) -> m (Maybe StyleSheet)
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((StyleSheetList
self StyleSheetList
-> Getting (JSM JSVal) StyleSheetList (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
"item" [Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]) JSM JSVal
-> (JSVal -> DOM (Maybe StyleSheet)) -> DOM (Maybe StyleSheet)
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 (Maybe StyleSheet)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal)
item_ :: (MonadDOM m) => StyleSheetList -> Word -> m ()
item_ :: forall (m :: * -> *). MonadDOM m => StyleSheetList -> Word -> m ()
item_ StyleSheetList
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 (StyleSheetList
self StyleSheetList
-> Getting (JSM JSVal) StyleSheetList (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
"item" [Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]))
itemUnsafe ::
(MonadDOM m, HasCallStack) =>
StyleSheetList -> Word -> m StyleSheet
itemUnsafe :: forall (m :: * -> *).
(MonadDOM m, HasCallStack) =>
StyleSheetList -> Word -> m StyleSheet
itemUnsafe StyleSheetList
self Word
index
= DOM StyleSheet -> m StyleSheet
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((StyleSheetList
self StyleSheetList
-> Getting (JSM JSVal) StyleSheetList (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
"item" [Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]) JSM JSVal
-> (JSVal -> DOM (Maybe StyleSheet)) -> DOM (Maybe StyleSheet)
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 (Maybe StyleSheet)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal) DOM (Maybe StyleSheet)
-> (Maybe StyleSheet -> DOM StyleSheet) -> DOM StyleSheet
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
DOM StyleSheet
-> (StyleSheet -> DOM StyleSheet)
-> Maybe StyleSheet
-> DOM StyleSheet
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> DOM StyleSheet
forall a. HasCallStack => String -> a
Prelude.error String
"Nothing to return") StyleSheet -> DOM StyleSheet
forall a. a -> JSM a
forall (m :: * -> *) a. Monad m => a -> m a
return)
itemUnchecked ::
(MonadDOM m) => StyleSheetList -> Word -> m StyleSheet
itemUnchecked :: forall (m :: * -> *).
MonadDOM m =>
StyleSheetList -> Word -> m StyleSheet
itemUnchecked StyleSheetList
self Word
index
= DOM StyleSheet -> m StyleSheet
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
((StyleSheetList
self StyleSheetList
-> Getting (JSM JSVal) StyleSheetList (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
"item" [Word -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Word
index]) JSM JSVal -> (JSVal -> DOM StyleSheet) -> DOM StyleSheet
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 StyleSheet
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
get ::
(MonadDOM m, ToJSString name) =>
StyleSheetList -> name -> m CSSStyleSheet
get :: forall (m :: * -> *) name.
(MonadDOM m, ToJSString name) =>
StyleSheetList -> name -> m CSSStyleSheet
get StyleSheetList
self name
name = DOM CSSStyleSheet -> m CSSStyleSheet
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((StyleSheetList
self StyleSheetList -> name -> JSM JSVal
forall this name.
(MakeObject this, ToJSString name) =>
this -> name -> JSM JSVal
! name
name) JSM JSVal -> (JSVal -> DOM CSSStyleSheet) -> DOM CSSStyleSheet
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 CSSStyleSheet
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
get_ ::
(MonadDOM m, ToJSString name) => StyleSheetList -> name -> m ()
get_ :: forall (m :: * -> *) name.
(MonadDOM m, ToJSString name) =>
StyleSheetList -> name -> m ()
get_ StyleSheetList
self name
name = DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM (JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (StyleSheetList
self StyleSheetList -> name -> JSM JSVal
forall this name.
(MakeObject this, ToJSString name) =>
this -> name -> JSM JSVal
! name
name))
getLength :: (MonadDOM m) => StyleSheetList -> m Word
getLength :: forall (m :: * -> *). MonadDOM m => StyleSheetList -> m Word
getLength StyleSheetList
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
<$> ((StyleSheetList
self StyleSheetList
-> Getting (JSM JSVal) StyleSheetList (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter StyleSheetList (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"length") 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))