Skip to content

Instantly share code, notes, and snippets.

@Rizary
Created August 20, 2019 00:12
Show Gist options
  • Save Rizary/5c2ec2732af9556edd3bf5dc94965bfa to your computer and use it in GitHub Desktop.
Save Rizary/5c2ec2732af9556edd3bf5dc94965bfa to your computer and use it in GitHub Desktop.
_ <- mdo
historyState <- manageHistory $ HistoryCommand_PushState <$> setState
let
f (currentSet, currentHistoryState, oldRoute) idxChange =
let newRoute = switchPkgRoute currentSet oldRoute idxChange
in
HistoryStateUpdate
{ _historyStateUpdate_state = DOM.SerializedScriptValue jsNull
, _historyStateUpdate_title = ""
, _historyStateUpdate_uri = newRoute
}
setState = attachWith f ((\a b c -> (a,b,c)) <$> current dynReports
<*> current historyState
<*> current dynLoc ) evIdxChange
pure historyState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment