I stumbled across this project Bitbucket and wonder is it possible to make that in Forge?
I know I can execute some js code in module issueViewBackgroundScript. Also I think I can detect issue viewed event but I don’t know how to handle moment that user leaves the issuse.
I thought maybe that can be done this way:
register issue viewed event and store that in some place like storage or issue properties
in issueViewBackgroundScript listen for some js leaving event
The three methods mentioned in the article “Top 3 ways to easily detect when a user leaves a page using JavaScript - DEV Community” will work well for detecting events at the top level of the page (parent document-level events). However, when using issueViewBackgroundScript, it runs in a hidden iframe that doesn’t have access to the parent window’s events. It’s also highly unlikely that Atlassian would forward these events to all Custom UI iframes.
Instead, I recommend setting up a timer in your JavaScript code that periodically sends “still alive” messages to the storage or entity properties, updating the “last visit time” for the user accordingly. When someone opens your panel, you can check the last visit time of all visitors, and if it’s within a defined threshold (e.g., a certain number of seconds), you can assume the person is still online.