Dogstudio / highway

Highway - A Modern Javascript Transitions Manager
https://highway.js.org/
MIT License
1.43k stars 92 forks source link

Wordpress Transition #49

Closed quentin-f451 closed 5 years ago

quentin-f451 commented 5 years ago

Hi there! I'm facing some issues when transforming a perfectly working static website using Highway to a Wordpress website. On click on a link that would trigger a transition to another page, nothing is happening and I got the following error

Uncaught (in promise) TypeError: Cannot read property 'href' of undefined

in this function that perfectly works with my static website:

H.on('NAVIGATE_IN', (to, location) => { console.log(location.href); });

Is there anything to know about using Highway with Wordpress? Thanks a lot.

Anthodpnt commented 5 years ago

Hi @quentin-f451,

The issue is not related to Wordpress but to a breaking change in the last release about the structure of the events callback parameters. We changed it to be more flexible.

Now in the v2.1.2 instead of (to, location) you should write ({ to, location }). This might not look like a big change but for further updates it was important to group parameters in an object developers can destructure to letus add as much entries as we need to expose more informations if needed in the future.

Best regards, Anthodpnt

quentin-f451 commented 5 years ago

Hi @Anthodpnt,

Thanks for your help! The problem was exactly that, also in my transition file where I hadn't changed from in(from, to, done) and out(from, done) to in({ from, to, trigger, done }) and out({ from, trigger, done }).

Best, Quentin