figma-messaging
v1.0.1
Published
Messaging library for Figma plugin developers
Downloads
47
Maintainers
Readme
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:
...handler parameters:
...handler responses:
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
andui
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.