Skip to content

Instantly share code, notes, and snippets.

@jefflee-figma
Created March 19, 2024 20:28
Show Gist options
  • Select an option

  • Save jefflee-figma/c83afb66b4bcd3f99935a854cc713c58 to your computer and use it in GitHub Desktop.

Select an option

Save jefflee-figma/c83afb66b4bcd3f99935a854cc713c58 to your computer and use it in GitHub Desktop.
figma.showUI(__html__);
async function main() {
for (let i = 0; i < 5; i++) {
figma.ui.postMessage({ i });
await new Promise((resolve) => setTimeout(resolve, 1000));
}
}
main()
.then(() => {
figma.closePlugin();
})
.catch((e) => {
console.error(e);
figma.closePlugin();
});
<script>
window.onmessage = (ev) => console.log(ev.data.pluginMessage);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment