Is there a Teams JS API I can use to listen to app window close event?

escdy 0 Reputation points
2025-05-06T03:22:59.44+00:00

I'm trying to do some cleanup on close of Teams window. Is there a Teams JS API I can use to listen to app window close event? registerBeforeUnloadHandler seems to only work when navigating from one tab to another.

Microsoft Teams Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nivedipa-MSFT 3,646 Reputation points Microsoft External Staff Moderator
    2025-05-06T05:12:31.8666667+00:00

    @escdy - Currently there is no direct API in Teams JS SDK specifically designed to handle the app window close events to perform cleanup tasks.
    To ensure your idea is considered for future updates, we recommend submitting it through the Teams Feedback Portal. Feature requests are reviewed by the engineering team and may be prioritized based on various factors, including the number of requests received. 

    If you have any additional thoughts or feedback, please feel free to share them with us. Your contributions are valuable and help improve the product! 

    Thank you again for your valuable suggestion! 

    Thanks, 

    Nivedipa 

    -----------------------------------------------------------------------------------------------------------

    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.