Reload event?

Hi everyone,

I noticed that upon reloading Obsidian (using the “Reload app without saving” command) plugins do not receive a call to the onunload handler.

Does the reload command emit any events a plugin could listen to instead?

I am interested because I develop a plugin that creates a tray/menubar icon which I destroy in unonload. Since the latter does not get called upon reloading Obsidian the tray icon gets duplicated after every reload. So I need a way to detect reloading and destroy the tray icon properly.

I also noticed neither onOpen or onload to trigger upon a forced reload (Cmd + R) in developer tools, which methods should be used for initialization?