1
votes

The azure-devops-extension-sdk has events that can be listened to for work items like onLoaded, onRefreshed, onUnloaded etc. But there's no event to listen to while the web page itself is being refreshed(navigating away). I need to stop the navigation action in case there are unsaved changes in my custom UI element. Azure DevOps does this inherently only in those cases where a standard backend field is used. My custom UI element (installed using an extension I developed) doesn't use any backend fields.

window.addEventListener function doesn't seem to work and neither did the window.beforeunload function.

1

1 Answers

1
votes

Seems you are using a hub extension. We could not use the window.beforeunload event of the browser which is not working in the case of an extension because it is running in an iframe.

After go through azure-devops-extension-api, didn't find any related interface. Afraid this is not available for a customized extension right now.