Please add OnSave() and OnClose() event handlers to Javascript based Office Add-in.
One of the Scenario is, When user works on an Excel or a word document, We need to capture few user information and make an API call to store it in our database. We need this to work in background. In this case, OnSave() or OnClose() handlers would be very useful.