forked from thelounge/thelounge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
92 lines (78 loc) · 2.41 KB
/
types.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
import {defineComponent} from "vue";
import Chan from "../../server/models/chan";
import Network from "../../server/models/network";
import User from "../../server/models/user";
import Message from "../../server/models/msg";
import {Mention} from "../../server/client";
import {ClientConfiguration} from "../../server/server";
import {LinkPreview} from "../../server/plugins/irc-events/link";
interface LoungeWindow extends Window {
g_TheLoungeRemoveLoading?: () => void;
navigator: Window["navigator"] & {
setAppBadge?: (highlightCount: number) => void;
clearAppBadge?: () => void;
};
}
type ClientUser = User & {
//
};
type ClientMessage = Omit<Message, "users"> & {
time: number;
users: string[];
};
type ClientChan = Omit<Chan, "users" | "messages"> & {
moreHistoryAvailable: boolean;
editTopic: boolean;
users: ClientUser[];
messages: ClientMessage[];
// these are added in store/initChannel
pendingMessage: string;
inputHistoryPosition: number;
inputHistory: string[];
historyLoading: boolean;
scrolledToBottom: boolean;
usersOutdated: boolean;
};
type InitClientChan = ClientChan & {
// total messages is deleted after its use when init event is sent/handled
totalMessages?: number;
};
// We omit channels so we can use ClientChan[] instead of Chan[]
type ClientNetwork = Omit<Network, "channels"> & {
isJoinChannelShown: boolean;
isCollapsed: boolean;
channels: ClientChan[];
};
type NetChan = {
channel: ClientChan;
network: ClientNetwork;
};
type ClientConfiguration = ClientConfiguration;
type ClientMention = Mention & {
localetime: string;
channel: NetChan | null;
};
type ClientLinkPreview = LinkPreview & {
sourceLoaded?: boolean;
};
interface BeforeInstallPromptEvent extends Event {
/**
* Returns an array of DOMString items containing the platforms on which the event was dispatched.
* This is provided for user agents that want to present a choice of versions to the user such as,
* for example, "web" or "play" which would allow the user to chose between a web version or
* an Android version.
*/
readonly platforms: Array<string>;
/**
* Returns a Promise that resolves to a DOMString containing either "accepted" or "dismissed".
*/
readonly userChoice: Promise<{
outcome: "accepted" | "dismissed";
platform: string;
}>;
/**
* Allows a developer to show the install prompt at a time of their own choosing.
* This method returns a Promise.
*/
prompt(): Promise<void>;
}