How would one go about synchronizing the Figma clientStorage and a Svelte store? I would like to update the svelte store on plugin launch to match the data in the clientStorage. And then before closing the plugin I would like to save all the svelte store data onto the clientStorage again
Any suggestions or examples of plugins that do that?
Solved
Figma clientStorage and Svelte store sync
Best answer by Stephane_Popout
I don’t have examples of plugins doing that but here is what I would do:
- For the initial retrieval:
- On the svelte app load, send an event to the figma backend asking for the figma clientstorage
- Return the figmaclient storage to the front
- store it in your svelte store
- For the saving before closing
- After every update of your store on svelte, you should update the figma store therefore when the user close the plugin it’s already saved
- Or, you can listen to the event close and do your saving before closing but it’s not recommended on | Plugin API
This topic has been closed for replies.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.