This repository was archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisconnectOverlay.ts
More file actions
47 lines (41 loc) · 1.62 KB
/
Copy pathDisconnectOverlay.ts
File metadata and controls
47 lines (41 loc) · 1.62 KB
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
// Copyright Epic Games, Inc. All Rights Reserved.
import { ActionOverlay } from './ActionOverlay';
/**
* Overlay shown during disconnection, has a reconnection element that can be clicked to reconnect.
*/
export class DisconnectOverlay extends ActionOverlay {
/**
* @returns The created root element of this overlay.
*/
public static createRootElement(): HTMLElement {
const disconnectOverlayHtml = document.createElement('div');
disconnectOverlayHtml.id = 'disconnectOverlay';
disconnectOverlayHtml.className = 'clickableState';
return disconnectOverlayHtml;
}
/**
* @returns The created content element of this overlay, which contain whatever content this element contains, like text or a button.
*/
public static createContentElement(): HTMLElement {
// build the inner html container
const disconnectOverlayHtmlContainer = document.createElement('div');
disconnectOverlayHtmlContainer.id = 'disconnectButton';
disconnectOverlayHtmlContainer.innerHTML = 'Click To Restart';
return disconnectOverlayHtmlContainer;
}
/**
* Construct a disconnect overlay with a retry connection icon.
* @param parentElem the parent element this overlay will be inserted into.
*/
public constructor(parentElem: HTMLElement) {
super(
parentElem,
DisconnectOverlay.createRootElement(),
DisconnectOverlay.createContentElement()
);
// add the new event listener
this.rootElement.addEventListener('click', () => {
this.activate();
});
}
}