0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-01-10 08:52:12 -05:00
penpot-plugins/libs/plugins-runtime/src/lib/index.d.ts

35 lines
832 B
TypeScript
Raw Normal View History

2024-02-27 08:50:38 -05:00
/* eslint-disable @typescript-eslint/no-explicit-any */
interface EventsMap {
pagechange: { name: string };
filechange: any;
selectionchange: string;
}
interface Penpot {
ui: {
open: (
name: string,
url: string,
options: { width: number; height: number }
) => void;
sendMessage: (message: unknown) => void;
onMessage: <T>(callback: (message: T) => void) => void;
};
log: (message: string) => void;
setTimeout: (callback: () => void, time: number) => void;
closePlugin: () => void;
on: <T extends keyof EventsMap>(
type: T,
callback: (event: EventsMap[T]) => void
) => void;
off: (type: string, callback: () => void) => void;
getFileState: () => any;
getPageState: () => any;
getSelection: () => any;
}
declare namespace globalThis {
const penpot: Penpot;
}