Do something on add-on disable?

Is there any way to execute some code when the add-on is disabled (not removed)?

The best you can do is add an 'unload' listener to the background window.
It won’t tell you why your extension is unloaded (disable/uninstall/reload/browser shutdown(?)/ …).

Ah okay, thanks for the help.