Is there a property or observable that is triggered on transition change?

I would like to trigger a function each time a URL is changed. Is there a way to do this within a plugin?

Thanks!

We have this API:

<script type="text/discourse-plugin" version="0.2">
    api.onPageChange((url, title) => {
       Em.run.next(()=>{
           $('body').addClass('xyz')
       });
    });
</script>
8 Likes