Skip to main content
Question

Typescript to figma plugin message "WAS" working fine. But not now!


Nidhin_Kuttikkattu_Rajeevan

Hi

  1. I created a Figma plugin (the orange rectangle creation as per Figma documentation)
  2. When I send message from HTML to typescript, it is working fine.
  3. I wrote a message handler in HTML. So that when I send a message from typescript to HTML, I can process it. Trust me, it was working fine. But not now.

Example is here…

in typescript,
Figma.ui.postMessage({ type: ‘totalSelected’, totalItemsSelected: selection.length });

in HTML,
window.onmessage = async (event) => {
const message = event.data.pluginMessage;
const type = message.type;
log(“Message:”, type, message);
console.log(“POST RECEIVED…”,message.type)
}

It was working… I am not sure, what happened 😦

This topic has been closed for replies.

3 replies

  • Figmate
  • 2112 replies
  • March 19, 2024

Hi @Nidhin_Kuttikkattu_Rajeevan, Thanks for reaching out! I completely understand how frustrating it can be when something suddenly stops working.

I’ve reached out to our team internally to see if we can assist with this issue. We’ll keep you updated once we have any new information.

If any of our community members have any insights or suggestions, please feel free to share them here!

Thanks,


jefflee
Figmate
  • Figmate
  • 24 replies
  • March 19, 2024

Can you specify what the actual error message is? Also, can you put your plugin code into a Github gist so we can see what you’re trying to do?

Here’s an example: code.ts · GitHub


Nidhin_Kuttikkattu_Rajeevan

To be honest I have a good news. I resolved the problem by going to Figma documentation, from there I got a github repository of Figma sample projects. There I found a PostMessage() example, I used that and it started working.


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