figma-messaging
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Figma Messaging

Messaging library for Figma plugin developers

Overview

Figma Messaging is a type-safe, auto-completing wrapper for Figma's Messaging API.

Set up correctly, it can auto-complete...

...handler ids:

screenshot

...handler parameters:

screenshot

...handler responses:

screenshot

You can use Figma Messaging in any Figma Plugin for robust, two-way messaging between main and ui processes.

Services

The package comprises two services, ipc and bus:

ipc is a low-level inter-process communication service which provides:

  • two-way communication between main and ui processes
  • awaitable call and response
  • catchable errors
  • optional logging

bus is a higher-level message bus service (which wraps ipc) to provide:

  • a formalised routing and handler setup
  • IDE auto-completion of known route names and parameters
  • typed parameter and return data for known routes
  • flexibility to call arbitrary / unknown routes
  • fallback handler for arbitrary / unknown routes

Generally, bus will be your first choice as it's more feature-rich and user-friendly.

Demo

To see real-world code, or to build and run a demo plugin live in Figma, check out the demo folder.

Next steps

Package Sidebar

Install

npm i figma-messaging

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

24.4 kB

Total Files

6

Last publish

Collaborators

  • davestewart