I have developed an Office add-in. It contains an editor where users could type and save a text.
I want to realise a feature: 1) One option is, when a user closes a spreadsheet/document, I want to remind them of saving the text on the add-in (by simply clicking on a button of the add-in); 2) another option is, when a user closes a spreadsheet/document, the text on add-in is systematically saved.
In either case, we need to be able to listen to the event when a document is closed, or a browser tab is closed (if it is Office Online).
Does anyone know how to realize this?