Determine type of update in the panel update method

I’m running some possibly processor intensive events on update() and I want to run those events only if there is a change to the artboard. Right now, if I simply change the selection the update method is called.

Use Case
If the user moved an rectangle then I want to know that the document has changed. If the user simply selected a different rectangle then the document has not changed and I want to avoid running any specific operations.

async update(type) {
  if (type=="selection") updateUI();
  else if (type=="move"|| type=="delete" || type=="valueChange") {
     await exportDocument();

Thanks for submitting this as a feature request. Currently, update function does not tell you what exact change has happened. While you can figure out what changed in your code mostly, we do understand it would be much easier if we provide the types. We will discuss this internally in the next feature request discussion session.

1 Like