0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-01-06 14:50:21 -05:00
penpot-plugins/docs/create-api.md

19 lines
368 B
Markdown
Raw Permalink Normal View History

2024-03-12 01:48:02 -05:00
# Create API
2024-02-06 06:16:28 -05:00
Add your API in `libs/plugins-runtime/src/lib/api/index.ts`.
Try to use `zod` to validate the input an output, for example:
```ts
{
sum: z.function()
.args(z.number(), z.number())
.returns(z.number())
.implement((callback, time) => {
setTimeout(callback, time);
});
}
```
2024-02-27 08:50:38 -05:00
Update `/libs/plugins-runtime/src/lib/api/index.d.ts`.