emit('popState')... can't get it do anything
See original GitHub issueExpected behavior
Could be my misunderstanding or using the wrong pattern; seems like emit(‘popState’) should call window.history.back()
Actual behavior
No observable behavior.
Steps to reproduce behavior
choo v.6.6.0
this.emitter.prependListener(this._events.POPSTATE, function () {
self.emitter.emit(self._events.NAVIGATE)
})
function onClick (e) {
emit('popState')
//window.history.back() //has desired affect.
}
<button onclick=${onClick}>
Back
</button>
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
window.onpopstate is not working; nothing happens when I ...
You get a popstate event only if you add one or more history entry/entries and later the user clicks the back button in...
Read more >PopStateEvent
A popstate event is dispatched to the window every time the active history entry changes between two history entries for the same document....
Read more >Window: popstate event - Web APIs | MDN
The popstate event of the Window interface is fired when the active history entry changes while the user navigates the session history.
Read more >Feature request: PopStateEvent (and maybe ... - GitHub
In creating a custom router, I was adding some tests around popstate events, and reached for this in dom-testing-library , but noticed popstate...
Read more >Add window.history.state and don't fire popstate after load
What steps will reproduce the problem? 1. Go to URL above. You should not get a alert box, but you will because Chrome...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Note that this is still incorrectly documented on the website https://github.com/choojs/website/issues/75
is this necessary when you can do
history.back()
?