3

I am trying to write a Greasemonkey/Tampermonkey script which tracks URL changes. (similar to polling approach mentioned here)

However, I would like to extend a bit such that if the page has Angular I would rather subscribe the routing events instead of polling. (How to detect a route change in Angular?)

Is it possible to subscribe to Angular events from userscripts?

gulucuk
  • 31
  • 1

1 Answers1

0

I am working with a script that looks like it is trying to do that in this block... but doesn't seem to properly detect the route.

const updateTragetOnState = (state) => {
    if (state.vssNavigationState?.routeId !== "ms.vss-code-web.create-pull-request-route") {
        // only work on create-pull-request-route
        return;
    }

For the record, that codeblock is not my own. It is a portion of a script sample submitted by Pei-Tang Huang for the purpose of working with modifying a pull request selection in Azure Devops. And in my case, it does not work.

DrDoomPDX
  • 282
  • 3
  • 12