My plugin has some stuff that needs to happen when it’s closed. It seems that when the document is closed with the plugin running, my plugin closing code doesn’t run. Is there any workaround to this? Because there is one instance of the plugin per document, a closing message or something should be available.
It can only run the closing code that is synchronous, meaning you can’t have any callbacks, async functions or network calls in the on close function.
so figma.on('close')
doesn’t get called if I just close the Figma document?
Oh, I didn’t read the question correctly, sorry. That seems like an edge-case to me. So no, it’s not called I believe (and I don’t know if it’s even technically possible with how browsers work). But I think if you share this feedback with the Figma team they might consider this for the future.
Is there an official API wish list somewhere? 🙂 What’s the right way to go about this?
No such list but you can post in the plugin API Feedback category, and a more effective way nowadays is to join the Friends of Figma discord and post there as the devs are active on there.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.