Skip to main content
Solved

Does Figma not let plugins properly close themselves before closing a document?

  • September 22, 2023
  • 5 replies
  • 465 views

Alex_FG

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.

Best answer by Gleb

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.

View original
This topic has been closed for replies.

5 replies

Gleb
  • Power Member
  • 4708 replies
  • Answer
  • September 22, 2023

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.


Alex_FG
  • Author
  • New Participant
  • 32 replies
  • September 22, 2023

so figma.on('close') doesn’t get called if I just close the Figma document?


Gleb
  • Power Member
  • 4708 replies
  • September 23, 2023

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.


Alex_FG
  • Author
  • New Participant
  • 32 replies
  • September 23, 2023

Is there an official API wish list somewhere? 🙂 What’s the right way to go about this?


Gleb
  • Power Member
  • 4708 replies
  • September 23, 2023

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings