----------------------------------------------------------------------------- -- | -- Module : Miso.Hydrate -- Copyright : (C) 2016-2025 David M. Johnson -- License : BSD3-style (see the file LICENSE) -- Maintainer : David M. Johnson <code@dmj.io> -- Stability : experimental -- Portability : non-portable -- -- Functions and helpers for Virtual DOM hydration. -- ---------------------------------------------------------------------------- module Miso.Hydrate ( hydrate ) where ----------------------------------------------------------------------------- import qualified Miso.FFI.Internal as FFI import Miso.Types import Miso.DSL ----------------------------------------------------------------------------- -- | Hydration of a t'VTree' hydrate :: LogLevel -> DOMRef -> VTree -> IO Bool hydrate :: LogLevel -> DOMRef -> VTree -> IO Bool hydrate LogLevel loggingLevel DOMRef domRef VTree vtree = do jval <- VTree -> IO DOMRef forall a. ToJSVal a => a -> IO DOMRef toJSVal VTree vtree fromJSValUnchecked =<< FFI.hydrate (loggingLevel `elem` [DebugHydrate, DebugAll]) domRef jval -----------------------------------------------------------------------------