Trigger a function everytime a route changes

This issue has been tracked since 2021-03-01.

Hello, I am trying to figure out how to run an analytic function every time the route changes.

I did not find anything in the documentation for this. Is this not possible?

fcsbr wrote this answer on 2021-03-08

Hey there,

Maybe issue #41 (comment) could be useful.

MarcGodard wrote this answer on 2021-03-08

I went a different direction:

  history.pushState = new Proxy(history.pushState, {
    apply (target, thisArg, argumentsList) {
     // run function stuff here
      Reflect.apply(target, thisArg, argumentsList)
    }
  })

This has been working very well.

More Details About Repo
Owner Name EmilTholin
Repo Name svelte-routing
Full Name EmilTholin/svelte-routing
Language JavaScript
Created Date 2017-11-28
Updated Date 2022-12-03
Star Count 1711
Watcher Count 21
Fork Count 151
Issue Count 59

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date