@amandam Indeed. It might be awkward though because Wix doesn’t allow us access to the window or document objects so i can listen to popstate
Though when i try i see this message: " Cannot find name ‘document’. Do you need to change your target library? Try changing the ‘lib’ compiler option to include ‘dom’."
I guess this is the Wix internal typescript complaining about not having DOM set in its tsconfig lib? Or is it possible to add DOM access some way?
I ideally would have a MutationObserver or window.addEventListener to watch popstate but none of thise seems allowed.
EDIT: Actually i just found i can do this, trying it now:
import wixLocation from ‘wix-location’;
wixLocation . onChange ( ( location ) => {
// parse the bit i want from the url!
} );
EDIT 2: that didn’t work as i expected, wixLocation.onChange seems broken or incomplete - it doesn’t always fire when there is a URL change, odd.