Hello!
Could you please clarify these questions?
I want to store my private plugin data and let users of the file listen for update events of that data. So, if userA changed some data, userB should handle this event and refresh own UI. I’m trying to use setPluginData and figma.on, but I faced with problems:
- On which node should I call setPluginData? Plugin’s container? If so, how can I access it? I found a node associated with my plugin in the Developers tools, but this node doesn’t have the pluginId from my manifest.json.
- Suppose I successfully stored my plugin’s data in a node. How I can handle data change event? Can I use this code? And which property I need to parse?
figma.on('documentchange', (event) => {
for (const change of event.documentChanges) {
switch (change.type) {
case "PROPERTY_CHANGE":
for (const prop of change.properties) {
// handle changed prop
}
break;
}
}
});