question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

emit('popState')... can't get it do anything

See original GitHub issue

Expected 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:closed
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Powersourcecommented, Apr 16, 2019

Note that this is still incorrectly documented on the website https://github.com/choojs/website/issues/75

1reaction
goto-bus-stopcommented, Jan 31, 2018

There’s currently no event to navigate backwards (or forwards) through the browser’s history. I agree we should probably have one.

is this necessary when you can do history.back()?

Read more comments on GitHub >

github_iconTop 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 >
PopState​Event
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found