diff --git a/obelisk/frontend/src/Pages/TechDemo.hs b/obelisk/frontend/src/Pages/TechDemo.hs index 77e48b0a243b08e007f276d08b46497c2ccb9961..d565609fbcf84537a07ce89504c2d9085cd567e2 100644 --- a/obelisk/frontend/src/Pages/TechDemo.hs +++ b/obelisk/frontend/src/Pages/TechDemo.hs @@ -119,9 +119,17 @@ techDemoPage = prerender_ (pure ()) $ do -- | Render a "Back" button hooked up to the browser history navigation action "back". navigationDemo :: (Prerender t m, DomBuilder t m) => m () navigationDemo = do + -- This renders a button into the page so there is something to see and + -- click on. It returns an `Event t ()` that triggers when the button is + -- clicked. backEv <- button "Back" - prerender_ blank $ do - -- performEvent_? Why? + + -- Only do the rest of this on the client. There's no way to look up the + -- browser Window or History when doing server-side rendering. + prerender_ blank $ + + -- Use performEvent_ to take an action on the Window whenever the event + -- triggers. performEvent_ . ffor backEv $ \() -> do windowM <- currentWindow case windowM of