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:
parent
1536d78fd6
commit
bf5221eb36
3 changed files with 11 additions and 1 deletions
|
@ -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');
|
||||
```
|
||||
|
|
|
@ -152,6 +152,7 @@ export function createApi(manifest: Manifest) {
|
|||
|
||||
return selection;
|
||||
},
|
||||
fetch,
|
||||
} as const;
|
||||
|
||||
return penpot;
|
||||
|
|
3
libs/plugins-runtime/src/lib/index.d.ts
vendored
3
libs/plugins-runtime/src/lib/index.d.ts
vendored
|
@ -40,7 +40,8 @@ interface Penpot {
|
|||
) => void;
|
||||
getFileState: () => File;
|
||||
getPageState: () => Page;
|
||||
getSelection: () => any;
|
||||
getSelection: () => string | null;
|
||||
fetch: typeof fetch;
|
||||
}
|
||||
|
||||
declare namespace globalThis {
|
||||
|
|
Loading…
Reference in a new issue