Does panel hide get called no matter how XD exits?

Does a panel’s hide entry get called if the panel is open and the user quits out of XD? I would presume so, but just want to make sure. (Since XD is quitting, I can’t see the console.log() to verify.)

(So I can put pref loading/unloading in panel show/hide, and make them async to boot…)

@peterflynn – Do you remember the behavior here?

Do you mean the hide() method?

Right, sorry, hide.

On Mac hide() is not called on closing the document nor on quitting XD. It seems instead that on Windows it’s being called if you close the document.

Thanks, that confirms what I suspected.

@stevekwak Wouldn’t the different behavior on macOS/Windows be considered a bug?

It’d sure be great to have hide() called reliably no matter how the panel is hidden (user plugins UI (switching back to listing), document close, XD quit).

1 Like

Would it be better to have a close method specifically for this purpose?

hide method was specifically designed to handle plugin hide event, which is triggered when user either opens another plugin or clicks on the back button. I agree that it would be better to have a close method for this since hide and close are supposed to be different. Appears that hide is wrongly called on document or XD quitting on Windows. What would be the use case for listening to close events? If there is a use case, we can convert this as a feature request.


Yes, you could call the new plugin event finalize() and make it a feature request:

Each plugin get a chance to clean up, save preferences, close resources, etc., when the plugin instance is going to be closed permanently (on document close (which is also implicit in application quit)).

This is fairly standard for plugins in other products.

1 Like