Skip to content

Commit

Permalink
Merge pull request #237 from reflex-frp/profile-static-widget
Browse files Browse the repository at this point in the history
Make StaticWidget work with the Reflex profiler
  • Loading branch information
Ryan Trinkle authored Sep 20, 2018
2 parents e28f91b + d81c8e2 commit 105dd76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions reflex-dom-core/src/Reflex/Dom/Builder/Static.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ import Data.Tuple
import GHC.Generics
import Reflex.Adjustable.Class
import Reflex.Class
import Reflex.Dom.Main (DomHost, DomTimeline, runDomHost)
import Reflex.Dom.Builder.Class
import Reflex.Dynamic
import Reflex.Host.Class
import Reflex.PerformEvent.Base
import Reflex.PerformEvent.Class
import Reflex.PostBuild.Base
import Reflex.Spider
import Reflex.TriggerEvent.Class

data StaticDomBuilderEnv t = StaticDomBuilderEnv
Expand Down Expand Up @@ -288,12 +288,12 @@ instance SupportsStaticDomBuilder t m => DomBuilder t (StaticDomBuilderT t m) wh
wrapRawElement () _ = return $ Element (EventSelector $ const never) ()

--TODO: Make this more abstract --TODO: Put the WithWebView underneath PerformEventT - I think this would perform better
type StaticWidget x = PostBuildT Spider (StaticDomBuilderT Spider (PerformEventT Spider (SpiderHost Global)))
type StaticWidget x = PostBuildT DomTimeline (StaticDomBuilderT DomTimeline (PerformEventT DomTimeline DomHost))

{-# INLINE renderStatic #-}
renderStatic :: StaticWidget x a -> IO (a, ByteString)
renderStatic w = do
runSpiderHost $ do
runDomHost $ do
(postBuild, postBuildTriggerRef) <- newEventWithTriggerRef
let env0 = StaticDomBuilderEnv True Nothing
((res, bs), FireCommand fire) <- hostPerformEventT $ runStaticDomBuilderT (runPostBuildT w postBuild) env0
Expand Down

0 comments on commit 105dd76

Please sign in to comment.