{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.CharacterData
(substringData, substringData_, appendData, insertData, deleteData,
replaceData, setData, getData, getLength, CharacterData(..),
gTypeCharacterData, IsCharacterData, toCharacterData)
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
substringData ::
(MonadDOM m, IsCharacterData self, FromJSString result) =>
self -> Word -> Word -> m result
substringData self offset count
= liftDOM
(((toCharacterData self) ^. jsf "substringData"
[toJSVal offset, toJSVal count])
>>= fromJSValUnchecked)
substringData_ ::
(MonadDOM m, IsCharacterData self) => self -> Word -> Word -> m ()
substringData_ self offset count
= liftDOM
(void
((toCharacterData self) ^. jsf "substringData"
[toJSVal offset, toJSVal count]))
appendData ::
(MonadDOM m, IsCharacterData self, ToJSString data') =>
self -> data' -> m ()
appendData self data'
= liftDOM
(void ((toCharacterData self) ^. jsf "appendData" [toJSVal data']))
insertData ::
(MonadDOM m, IsCharacterData self, ToJSString data') =>
self -> Word -> data' -> m ()
insertData self offset data'
= liftDOM
(void
((toCharacterData self) ^. jsf "insertData"
[toJSVal offset, toJSVal data']))
deleteData ::
(MonadDOM m, IsCharacterData self) => self -> Word -> Word -> m ()
deleteData self offset count
= liftDOM
(void
((toCharacterData self) ^. jsf "deleteData"
[toJSVal offset, toJSVal count]))
replaceData ::
(MonadDOM m, IsCharacterData self, ToJSString data') =>
self -> Word -> Word -> data' -> m ()
replaceData self offset count data'
= liftDOM
(void
((toCharacterData self) ^. jsf "replaceData"
[toJSVal offset, toJSVal count, toJSVal data']))
setData ::
(MonadDOM m, IsCharacterData self, ToJSString val) =>
self -> val -> m ()
setData self val
= liftDOM ((toCharacterData self) ^. jss "data" (toJSVal val))
getData ::
(MonadDOM m, IsCharacterData self, FromJSString result) =>
self -> m result
getData self
= liftDOM
(((toCharacterData self) ^. js "data") >>= fromJSValUnchecked)
getLength :: (MonadDOM m, IsCharacterData self) => self -> m Word
getLength self
= liftDOM
(round <$>
(((toCharacterData self) ^. js "length") >>= valToNumber))