-
Notifications
You must be signed in to change notification settings - Fork 45
/
index.d.ts
58 lines (52 loc) · 1.61 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/// <reference path="./plugin-api.d.ts" />
declare global {
// Global variable with Figma's plugin API.
const figma: PluginAPI
const __html__: string
const __uiFiles__: {
[key: string]: string
}
const console: Console
// The plugin environment exposes the browser console API,
// so expected calls like console.log() still work.
interface Console {
log(message?: any, ...optionalParams: any[]): void
error(message?: any, ...optionalParams: any[]): void
assert(condition?: boolean, message?: string, ...data: any[]): void
info(message?: any, ...optionalParams: any[]): void
warn(message?: any, ...optionalParams: any[]): void
clear(): void
}
function setTimeout(callback: Function, timeout: number): number
function clearTimeout(handle: number): void
function setInterval(callback: Function, timeout: number): number
function clearInterval(handle: number): void
const fetch: (url: string, init?: FetchOptions) => Promise<FetchResponse>
interface FetchOptions {
method?: string
headers?: { [name: string]: string }
/**
* @deprecated use headers instead
*/
headersObject?: { [name: string]: string }
body?: Uint8Array | string
credentials?: string
cache?: string
redirect?: string
referrer?: string
integrity?: string
}
interface FetchResponse {
headersObject: { [name: string]: string }
ok: boolean
redirected: boolean
status: number
statusText: string
type: string
url: string
arrayBuffer(): Promise<ArrayBuffer>
text(): Promise<string>
json(): Promise<any>
}
} // declare global
export {}