Created
August 19, 2019 23:42
-
-
Save Rizary/82cd31fcdaf1b09047e4eb50a98159c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window <- DOM.currentWindowUnchecked | |
history <- Window.getHistory window | |
location <- Window.getLocation window | |
oldUri <- (decodeFrag . T.pack . uriFragment) <$> getLocationUri location | |
backState <- wrapDomEvent window (`DOM.on` DOM.popState) $ do | |
e <- DOM.event | |
jV <- PopStateEvent.getState e | |
oUri <- liftJSM $ fromJSVal jV | |
pure $ decodeFrag $ fromMaybe (T.pack "") oUri | |
setState <- performEvent $ attachWith (switchRoutingState' history) (current route) changeStateE | |
route <- foldDynMaybe switchFrag oldUri $ setState | |
(result, changeStateE) <- runSetRouteT $ strictDynWidget_ app route | |
pure result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment