Created
August 19, 2019 23:40
-
-
Save rizary/779682ada7afb5e0ba2d20b3419acc69 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 | |
| location <- Window.getLocation window | |
| history <- Window.getHistory window | |
| let getCurrentHistoryItem = HistoryItem | |
| <$> History.getState history | |
| <*> getLocationUri location | |
| item0 <- liftJSM getCurrentHistoryItem | |
| itemSetInternal <- performEvent $ ffor runCmd $ \cmd -> liftJSM $ do | |
| runHistoryCommand history cmd | |
| getCurrentHistoryItem | |
| itemSetExternal <- wrapDomEvent window (`DOM.on` DOM.popState) $ do | |
| e <- DOM.event | |
| HistoryItem | |
| <$> (SerializedScriptValue <$> PopStateEvent.getState e) | |
| <*> getLocationUri location | |
| holdDyn item0 $ leftmost [itemSetInternal, itemSetExternal] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment