I am trying to traverse the trees in the document pages and find the text layers. It takes some time to execute the task on huge documents, so I do not want the clients to experience the long waiting and think that the plugin is stuck. My thought was to show which Pages and their children are currently being processed, and to send instantly the messages to UI part via figma.ui.postMessage
, but I was out of luck. It seems like the process is blocking the main Thread and it queues these messages to send them after the process is finished. I thought of also maybe using figma.notify
function to notify the user by showing a message via Figma, but it works in the same way. I pretty understand that changing the document in another thread and sending messages from iframe to main thread is not good idea, but I do not see any problems to notify the UI immediately every time I call figma.ui.postMessage
. But, I may be wrong, but seems like Figma and iframe’d plugins work on the same main Thread and that is why I even cannot close the plugin while calling the findAll, findOne methods or even iterating over the PageNode children
Question
Figma.notify and figma.ui.postMessage do not work in background
Reply
Rich Text Editor, editor1
Editor toolbars
Press ALT 0 for help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.