forked from cmss13-devs/cmss13
-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.d.ts
178 lines (151 loc) · 4.17 KB
/
global.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/**
* @file
* @copyright 2021 Aleksej Komarov
* @license MIT
*/
// Webpack asset modules.
// Should match extensions used in webpack config.
declare module '*.png' {
const content: string;
export default content;
}
declare module '*.jpg' {
const content: string;
export default content;
}
declare module '*.svg' {
const content: string;
export default content;
}
namespace JSX {
interface IntrinsicElements {
marquee: any;
blink: any;
}
}
type TguiMessage = {
type: string;
payload?: any;
[key: string]: any;
};
type ByondType = {
/**
* ID of the Byond window this script is running on.
* Can be used as a parameter to winget/winset.
*/
windowId: string;
/**
* If `true`, unhandled errors and common mistakes result in a blue screen
* of death, which stops this window from handling incoming messages and
* closes the active instance of tgui datum if there was one.
*
* It can be defined in window.initialize() in DM, or changed in runtime
* here via this property to `true` or `false`.
*
* It is recommended that you keep this ON to detect hard to find bugs.
*/
strictMode: boolean;
/**
* Makes a BYOND call.
*
* If path is empty, this will trigger a Topic call.
* You can reference a specific object by setting the "src" parameter.
*
* See: https://secure.byond.com/docs/ref/skinparams.html
*/
call(path: string, params: object): void;
/**
* Makes an asynchronous BYOND call. Returns a promise.
*/
callAsync(path: string, params: object): Promise<any>;
/**
* Makes a Topic call.
*
* You can reference a specific object by setting the "src" parameter.
*/
topic(params: object): void;
/**
* Runs a command or a verb.
*/
command(command: string): void;
/**
* Retrieves all properties of the BYOND skin element.
*
* Returns a promise with a key-value object containing all properties.
*/
winget(id: string | null): Promise<object>;
/**
* Retrieves all properties of the BYOND skin element.
*
* Returns a promise with a key-value object containing all properties.
*/
winget(id: string | null, propName: '*'): Promise<object>;
/**
* Retrieves an exactly one property of the BYOND skin element,
* as defined in `propName`.
*
* Returns a promise with the value of that property.
*/
winget(id: string | null, propName: string): Promise<any>;
/**
* Retrieves multiple properties of the BYOND skin element,
* as defined in the `propNames` array.
*
* Returns a promise with a key-value object containing listed properties.
*/
winget(id: string | null, propNames: string[]): Promise<object>;
/**
* Assigns properties to BYOND skin elements in bulk.
*/
winset(props: object): void;
/**
* Assigns properties to the BYOND skin element.
*/
winset(id: string | null, props: object): void;
/**
* Sets a property on the BYOND skin element to a certain value.
*/
winset(id: string | null, propName: string, propValue: any): void;
/**
* Parses BYOND JSON.
*
* Uses a special encoding to preserve `Infinity` and `NaN`.
*/
parseJson(text: string): any;
/**
* Sends a message to `/datum/tgui_window` which hosts this window instance.
*/
sendMessage(type: string, payload?: any): void;
sendMessage(message: TguiMessage): void;
/**
* Subscribe to incoming messages that were sent from `/datum/tgui_window`.
*/
subscribe(listener: (type: string, payload: any) => void): void;
/**
* Subscribe to incoming messages *of some specific type*
* that were sent from `/datum/tgui_window`.
*/
subscribeTo(type: string, listener: (payload: any) => void): void;
/**
* Loads a stylesheet into the document.
*/
loadCss(url: string): void;
/**
* Loads a script into the document.
*/
loadJs(url: string): void;
/**
* The ByondCSS stylesheet to load into ByondUI components
*/
styleSheet: string;
};
/**
* Object that provides access to Byond Skin API and is available in
* any tgui application.
*/
const Byond: ByondType;
interface Window {
Byond: ByondType;
__store__: Store<unknown, AnyAction>;
__augmentStack__: (store: Store) => StackAugmentor;
}