Skip to content

Commit

Permalink
Use native event listeners, do NOT trust the existence of window.lightdm
Browse files Browse the repository at this point in the history
  • Loading branch information
NoiSek committed May 21, 2018
1 parent 30f7267 commit ee84c47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
<script type="text/javascript">
window.__debug = false;

if (window.lightdm === undefined) {
window.__debug = true;

if (window.__debug === true) {
window.lightdm = {
"authenticate": function(){ return true; },
"hibernate": function(){ return true; },
Expand Down
9 changes: 7 additions & 2 deletions src/js/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ window.onload = (e) => {
document.getElementById("password-field").focus();
};

// Horribly convoluted for necessity because reasons
if (window.__debug === false) {
$(window).on('GreeterReady', () => {
if (window.lightdm === undefined) {
document.addEventListener('GreeterReady', () => {
init();
});
} else {
init();
});
}
} else {
init();
}
Expand Down

0 comments on commit ee84c47

Please sign in to comment.