How to listen for frame changes in embed


I know that Figma emitted events so that developers can listen to some of the event that Figma notifies, but how do I know if the prototype is presenting the last frame?

Thank You!

This is only available when running a plugin and using the plugins API, which is not accessible in embeds. There is no way to listen to events in embeds.

Figma recently updated the documentation for embeds.

Store the nodeId value of the last frame and compare it with the presentedNodeId value that is available in the event message data with the PRESENTED_NODE_CHANGED type. Or with targetNodeId in a message with the MOUSE_PRESS_OR_RELEASE type.

Oh wow cool!

Sorry for the late respond.

Thank you but, how do I get that nodeId? If I’m trying to get that from the NEW_STATE event, the nodeId is not the same as the presentedNodeId that emitted from PRESENTED_NODE_CHANGED event.

Here’s how I handle that:

      window.addEventListener('message', event => {
        const { type, } =;
        if (!type) return;
        if (type === 'NEW_STATE') {
        if (type.includes('PRESENTED_NODE_CHANGED')) {
          const { presentedNodeId } =;
            '[PRESENTED_NODE_CHANGED] presentedNodeId:',

And this is the logs:

Get the nodeId of the last frame manually (for example, from a prototype or design link) and hardcode it.

This is a new API that I think is just starting to develop. Perhaps more features and data will be added in the future.

1 Like

Right, Thank you!!