Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rojcyk authored Jul 17, 2021
1 parent adba7d6 commit f87958d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ So basically, in the plugin UI, you deal with the user interaction (all the butt

## Installation

Very simple to do, just install it via `npm install figmaio` or `yarn add figmaio`.
Very simple to do, just install it via

```bash
# NPM
npm install --save-dev figmaio

# Yarn
yarn add -D figmaio
```

## How to use

Expand Down Expand Up @@ -56,7 +64,7 @@ io.on('data_update', (data) => {
);
```

If the data is critical for you and you need to stop and wait for it, you use async for that.
If the data is critical for you and you need to stop and wait for it, you can use async for that.

```js
const data = await io.async('data_update')
Expand All @@ -82,11 +90,10 @@ const cachedData = 'some cached data'
switch (figma.command) {
/* If we are running the plugin from the Figma plugin menu, it is starting with no command.
* And if you are clicking on the editor sidebar plugin command, figma starts the plugin
* with 'edit' value for command, but since my plugin does not directly benefit from it, it just
* sends it with 'start' anyways.
* with with whaveter you specify in the manifest.json
*/

case 'edit':
case 'something':
if (io) io.send('start', cachedData);
break
default:
Expand Down

0 comments on commit f87958d

Please sign in to comment.