I'm using vue 3 and want to run a function on browser back button press in a component.
This approach targets both back and forward button presses:
window.onpopstate = () => {
console.log('pop')
}
How can I target only the back press?