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

feat: add fetch api

This commit is contained in:
Juanfran 2024-03-04 14:11:34 +01:00
parent 1536d78fd6
commit bf5221eb36
3 changed files with 11 additions and 1 deletions

View file

@ -63,3 +63,11 @@ penpot.on('pagechange', event);
penpot.off('pagechange', event);
```
### Requests
Same as the browser fetch API.
```ts
penpot.fetch('http://example.com/movies.json');
```

View file

@ -152,6 +152,7 @@ export function createApi(manifest: Manifest) {
return selection;
},
fetch,
} as const;
return penpot;

View file

@ -40,7 +40,8 @@ interface Penpot {
) => void;
getFileState: () => File;
getPageState: () => Page;
getSelection: () => any;
getSelection: () => string | null;
fetch: typeof fetch;
}
declare namespace globalThis {