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


(Eric Berry) #1

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

Thanks!


(Rafael dos Santos Silva) #2

We have this API:

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