Closed b31jung closed 8 years ago
After investigating the code for a while, I realized the functions like replace
get attached to the observable, not to the location objects.
I misunderstood this paragraph,
In return you will be given an Rx.Observable with the current Location. With some extra functions appended.The functions appended to the returned Observable can be found here. All of those functions are exposed except for listen(). (https://github.com/cyclejs/cycle-history/blob/master/docs/historyDriver.md)
So there's no problem with accessing the functionalities inside an app. Sorry for the issue :(
From my understanding, from Cycle.js's viewpoint, imperative APIs such as
history.replace
should be run through drivers. I think that's why the location object accessible from source observable has some additional functions, likelocation.replace
orlocation.goBack
. However, I found the initial location is not emitted for 1.1.0, which means I should access the history object myself outside of drivers to use such functions on the initial page. I tried working around like this,but this duplicates the initial location in history list. (
window.location.pathname
pushed unnecessarily) Am I properly understanding the framework?