{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.TreeWalker
(parentNode, parentNode_, parentNodeUnsafe, parentNodeUnchecked,
firstChild, firstChild_, firstChildUnsafe, firstChildUnchecked,
lastChild, lastChild_, lastChildUnsafe, lastChildUnchecked,
previousSibling, previousSibling_, previousSiblingUnsafe,
previousSiblingUnchecked, nextSibling, nextSibling_,
nextSiblingUnsafe, nextSiblingUnchecked, previousNode,
previousNode_, previousNodeUnsafe, previousNodeUnchecked, nextNode,
nextNode_, nextNodeUnsafe, nextNodeUnchecked, getRoot,
getWhatToShow, setCurrentNode, getCurrentNode, TreeWalker(..),
gTypeTreeWalker)
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
parentNode :: (MonadDOM m) => TreeWalker -> m (Maybe Node)
parentNode self
= liftDOM ((self ^. jsf "parentNode" ()) >>= fromJSVal)
parentNode_ :: (MonadDOM m) => TreeWalker -> m ()
parentNode_ self = liftDOM (void (self ^. jsf "parentNode" ()))
parentNodeUnsafe ::
(MonadDOM m, HasCallStack) => TreeWalker -> m Node
parentNodeUnsafe self
= liftDOM
(((self ^. jsf "parentNode" ()) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
parentNodeUnchecked :: (MonadDOM m) => TreeWalker -> m Node
parentNodeUnchecked self
= liftDOM ((self ^. jsf "parentNode" ()) >>= fromJSValUnchecked)
firstChild :: (MonadDOM m) => TreeWalker -> m (Maybe Node)
firstChild self
= liftDOM ((self ^. jsf "firstChild" ()) >>= fromJSVal)
firstChild_ :: (MonadDOM m) => TreeWalker -> m ()
firstChild_ self = liftDOM (void (self ^. jsf "firstChild" ()))
firstChildUnsafe ::
(MonadDOM m, HasCallStack) => TreeWalker -> m Node
firstChildUnsafe self
= liftDOM
(((self ^. jsf "firstChild" ()) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
firstChildUnchecked :: (MonadDOM m) => TreeWalker -> m Node
firstChildUnchecked self
= liftDOM ((self ^. jsf "firstChild" ()) >>= fromJSValUnchecked)
lastChild :: (MonadDOM m) => TreeWalker -> m (Maybe Node)
lastChild self
= liftDOM ((self ^. jsf "lastChild" ()) >>= fromJSVal)
lastChild_ :: (MonadDOM m) => TreeWalker -> m ()
lastChild_ self = liftDOM (void (self ^. jsf "lastChild" ()))
lastChildUnsafe ::
(MonadDOM m, HasCallStack) => TreeWalker -> m Node
lastChildUnsafe self
= liftDOM
(((self ^. jsf "lastChild" ()) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
lastChildUnchecked :: (MonadDOM m) => TreeWalker -> m Node
lastChildUnchecked self
= liftDOM ((self ^. jsf "lastChild" ()) >>= fromJSValUnchecked)
previousSibling :: (MonadDOM m) => TreeWalker -> m (Maybe Node)
previousSibling self
= liftDOM ((self ^. jsf "previousSibling" ()) >>= fromJSVal)
previousSibling_ :: (MonadDOM m) => TreeWalker -> m ()
previousSibling_ self
= liftDOM (void (self ^. jsf "previousSibling" ()))
previousSiblingUnsafe ::
(MonadDOM m, HasCallStack) => TreeWalker -> m Node
previousSiblingUnsafe self
= liftDOM
(((self ^. jsf "previousSibling" ()) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
previousSiblingUnchecked :: (MonadDOM m) => TreeWalker -> m Node
previousSiblingUnchecked self
= liftDOM
((self ^. jsf "previousSibling" ()) >>= fromJSValUnchecked)
nextSibling :: (MonadDOM m) => TreeWalker -> m (Maybe Node)
nextSibling self
= liftDOM ((self ^. jsf "nextSibling" ()) >>= fromJSVal)
nextSibling_ :: (MonadDOM m) => TreeWalker -> m ()
nextSibling_ self = liftDOM (void (self ^. jsf "nextSibling" ()))
nextSiblingUnsafe ::
(MonadDOM m, HasCallStack) => TreeWalker -> m Node
nextSiblingUnsafe self
= liftDOM
(((self ^. jsf "nextSibling" ()) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
nextSiblingUnchecked :: (MonadDOM m) => TreeWalker -> m Node
nextSiblingUnchecked self
= liftDOM ((self ^. jsf "nextSibling" ()) >>= fromJSValUnchecked)
previousNode :: (MonadDOM m) => TreeWalker -> m (Maybe Node)
previousNode self
= liftDOM ((self ^. jsf "previousNode" ()) >>= fromJSVal)
previousNode_ :: (MonadDOM m) => TreeWalker -> m ()
previousNode_ self = liftDOM (void (self ^. jsf "previousNode" ()))
previousNodeUnsafe ::
(MonadDOM m, HasCallStack) => TreeWalker -> m Node
previousNodeUnsafe self
= liftDOM
(((self ^. jsf "previousNode" ()) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
previousNodeUnchecked :: (MonadDOM m) => TreeWalker -> m Node
previousNodeUnchecked self
= liftDOM ((self ^. jsf "previousNode" ()) >>= fromJSValUnchecked)
nextNode :: (MonadDOM m) => TreeWalker -> m (Maybe Node)
nextNode self = liftDOM ((self ^. jsf "nextNode" ()) >>= fromJSVal)
nextNode_ :: (MonadDOM m) => TreeWalker -> m ()
nextNode_ self = liftDOM (void (self ^. jsf "nextNode" ()))
nextNodeUnsafe ::
(MonadDOM m, HasCallStack) => TreeWalker -> m Node
nextNodeUnsafe self
= liftDOM
(((self ^. jsf "nextNode" ()) >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
nextNodeUnchecked :: (MonadDOM m) => TreeWalker -> m Node
nextNodeUnchecked self
= liftDOM ((self ^. jsf "nextNode" ()) >>= fromJSValUnchecked)
getRoot :: (MonadDOM m) => TreeWalker -> m Node
getRoot self = liftDOM ((self ^. js "root") >>= fromJSValUnchecked)
getWhatToShow :: (MonadDOM m) => TreeWalker -> m Word
getWhatToShow self
= liftDOM (round <$> ((self ^. js "whatToShow") >>= valToNumber))
setCurrentNode ::
(MonadDOM m, IsNode val) => TreeWalker -> val -> m ()
setCurrentNode self val
= liftDOM (self ^. jss "currentNode" (toJSVal val))
getCurrentNode :: (MonadDOM m) => TreeWalker -> m Node
getCurrentNode self
= liftDOM ((self ^. js "currentNode") >>= fromJSValUnchecked)