This repository was archived by the owner on Apr 29, 2024. It is now read-only.
forked from EpicGames/PixelStreamingInfrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnectOverlay.ts
More file actions
45 lines (40 loc) · 1.46 KB
/
ConnectOverlay.ts
File metadata and controls
45 lines (40 loc) · 1.46 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
// Copyright Epic Games, Inc. All Rights Reserved.
import { ActionOverlay } from './ActionOverlay';
/**
* Overlay shown during connection, has a button that can be clicked to initiate a connection.
*/
export class ConnectOverlay extends ActionOverlay {
/**
* @returns The created root element of this overlay.
*/
public static createRootElement(): HTMLElement {
const connectElem = document.createElement('div');
connectElem.id = 'connectOverlay';
connectElem.className = 'clickableState';
return connectElem;
}
/**
* @returns The created content element of this overlay, which contain whatever content this element contains, like text or a button.
*/
public static createContentElement(): HTMLElement {
const connectContentElem = document.createElement('div');
connectContentElem.id = 'connectButton';
connectContentElem.innerHTML = 'Click to start';
return connectContentElem;
}
/**
* Construct a connect overlay with a connection button.
* @param parentElem the parent element this overlay will be inserted into.
*/
public constructor(parentElem: HTMLElement) {
super(
parentElem,
ConnectOverlay.createRootElement(),
ConnectOverlay.createContentElement()
);
// add the new event listener
this.rootElement.addEventListener('click', () => {
this.activate();
});
}
}