-
-
Notifications
You must be signed in to change notification settings - Fork 289
Expand file tree
/
Copy pathevents.js
More file actions
110 lines (104 loc) · 3.19 KB
/
Copy pathevents.js
File metadata and controls
110 lines (104 loc) · 3.19 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
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
export class DialogClosedEvent extends CustomEvent {
/**
* Event that will close the overlay.
*/
constructor() {
super("dialog-closed", {
bubbles: true,
composed: true,
});
}
}
export class DialogFailedEvent extends CustomEvent {
/**
* Event that closes the dialog and displays the error dialog instead.
* @param {Object} errorInfo
* @param {string} errorInfo.title - A concise summary of the error.
* @param {string} [errorInfo.message] - A user-friendly and helpful message
* that ideally gives the user some guidance what to do now. Defaults
* to a generic message.
* @param {string|Error} [errorInfo.details] - The technical error details,
* e.g. the original error message from the API or library call.
* @param {boolean} [errorInfo.isShareable] - Whether there should be a button
* for uploading the error details to the logs server.
*/
constructor(errorInfo) {
super("dialog-failed", {
detail: errorInfo,
bubbles: true,
composed: true,
});
}
}
export class DialogCloseStateChangedEvent extends CustomEvent {
/**
* Event that advises a state change affecting the dialog close
* behavior: `canBeClosed` (defaults to true), informs that the
* new state allows, or not, the dialog to be closed.
*/
constructor(canBeClosed = true) {
super("dialog-close-state-changed", {
detail: {
canBeClosed,
},
bubbles: true,
composed: true,
});
}
}
export class DialogVariantChangedEvent extends CustomEvent {
/**
* Event that advises a visual variant style change of the dialog.
* @param {("default"|"danger"|"success")} variant
*/
constructor(variant) {
super("dialog-variant-changed", {
detail: {
variant,
},
bubbles: true,
composed: true,
});
}
}
export class VideoStreamingModeChangedEvent extends CustomEvent {
/**
* Event, which indicates that the video streaming mode has changed.
* @param {string} mode - The new mode, e.g.: `MJPEG` or `H264`.
*/
constructor(mode) {
super("video-streaming-mode-changed", {
detail: {
mode,
},
bubbles: true,
composed: true,
});
}
}
export class SecureConnectionRequiredEvent extends CustomEvent {
/**
* Event that will trigger the “secure connection required” dialog. For
* security reasons, we require an HTTPS connection for all dialogs that
* facilitate security-related settings. Such security-related dialogs
* shouldn’t open on an HTTP connection, but instead defer to the “secure
* connection required” dialog by dispatching this event upon initialization.
*/
constructor() {
super("secure-connection-required", {
bubbles: true,
composed: true,
});
}
/**
* Checks whether the preconditions are met for this event to be dispatched.
* @returns {boolean}
*/
static isApplicable() {
// Suppress ESLint warnings about undefined variables.
// `isInDebugMode` is defined in app/templates/components/debug-mode.html,
// which is available globally on the page.
/* global isInDebugMode */
return !isInDebugMode() && window.location.protocol === "http:";
}
}