Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/colebemis/figjam-live-code-block

Turn FigJam into a collaborative JavaScript canvas
https://github.com/colebemis/figjam-live-code-block

figjam figjam-plugin figjam-widget figma figma-plugin

Last synced: 15 days ago
JSON representation

Turn FigJam into a collaborative JavaScript canvas

Awesome Lists containing this project

README

        

# FigJam Live Code Block Widget

Turn FigJam into a collaborative JavaScript canvas

![demo](assets/demo.gif)

Could be used for:

- Exploring APIs
- Teaching
- Debugging
- Pair programming
- Code review
- Technical interviews
- ???

Found a creative use for this widget? Tell me about it on Twitter ([@colebemis](https://twitter.com/colebemis))

## Installation

https://www.figma.com/community/widget/1034005547769330556

## Global variables

Every live code block has access to the following variables:

| Name | Type | Description |
| ---------------------- | ---------- | --------------------------------------------------------------------------------------------------- |
| `fetch()` | `function` | [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/fetch) |
| `fetchJson()` | `function` | A convenient wrapper around `fetch()` specifically for fetching JSON data |
| `Math` | `object` | [MDN docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math) |
| `Array` | `object` | [MDN docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) |
| `Object` | `object` | [MDN docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) |

## Local development

1. Clone the repository

```shell
git clone https://github.com/colebemis/figjam-javascript-repl.git
cd figjam-javascript-repl
```

1. Install the dependencies

```shell
yarn
```

1. Run local development scripts

```shell
yarn start
```

1. Open the [Figma desktop app](https://www.figma.com/downloads/)

1. Inside a FigJam file, go to `Menu > Widgets > Development > Import widget from manifest...`

1. Select `/path/to/figjam-javascript-repl/manifest.json`

1. Add the widget to the canvas by selecting `Menu > Widgets > Developement > JavaScript REPL` or search for `JavaScript REPL` in the quick actions bar (`⌘ /`)

## Prior art

- [natto.dev](https://natto.dev/) by [@\_paulshen](https://twitter.com/_paulshen)