
Member-only story
Listening for selection changes with the Figma plugin API
Building a Figma plugin: part 3 of 6
** The code for this section is here.**
We can finally write some plugin code 🎉. First off we need to outline what our plugin needs to do.
🎰 Basic Functionality
The basic flow of our plugin looks like follows:

Let’s block this out in our code.
Go ahead and delete everything in code.js
except for the line: figma.showUI(__html__)
so we have a clean slate.
👂 Listening for Selection Changes
The first thing we are going to mock up is listening for user selection changes. We can use the built in selection change listener on the figma
instance like this: