blob: 14a187d196878fc8ce4debea16dbc47a332927ad (
plain)
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
|
// Cannot be changed after being set.
import { RookType } from "../models/rook_type";
let clientType: RookType = null;
export function setClientType(type: RookType) {
if (clientType === null) {
clientType = type;
} else {
throw new Error("Tried changing client type after initialization.");
}
}
export function isClientShare() {
if (clientType === null) {
throw new Error(
"Tried accessing client type before initialization was completed."
);
}
return clientType === RookType.SHARE;
}
export function isClientRequest() {
if (clientType === null) {
throw new Error(
"Tried accessing client type before initialization was completed."
);
}
return clientType === RookType.REQUEST;
}
|