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…)
@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).
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.
Hi,
although it’s an old entry, I hope someone is still looking at it…
I’m also interested in a reliable way to get noticed when a document is about to be closed.
My use case is that I want to offer the user a dialog by which he can choose to upload the image to a server. Is there a reliable, platform independent way to get noticed when the document is about to be closed? It has to be before the actual close because I want to display a blocking/modal dialog which prevents XD from shutting down the plug-in.