Skip to content

Commit

Permalink
Check for lightdm in window and if languages is an object
Browse files Browse the repository at this point in the history
Addresses issue FallingSnow#2
  • Loading branch information
cytodev committed Mar 1, 2017
1 parent 0b48c89 commit bf231dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();

// Load mock if in development mode
if (!lightdm && process.env.NODE_ENV === 'development') {
if (!(lightdm in window) && process.env.NODE_ENV === 'development') {
const LightDMMock = require("../LightDMMock/mock/LightDMMock.js");
// const LightDMMock = require("../LightDMMock/src/LightDMMock.js");
window.lightdm = new LightDMMock(true, 0, false);
Expand Down Expand Up @@ -46,15 +46,15 @@ if (!lightdm && process.env.NODE_ENV === 'development') {
}
}

if (!lightdm || !lightdm.languages) {
if (!(lightdm in window) || !(typeof lightdm.languages === "object")) {
const timeout = setTimeout(() => {
clearInterval(interval);
document.body.innerHTML += '<h1 style="background-color: white; color: red;">Lightdm did not load</h1>';
throw new Error('lightdm did not load in time');
}, 1000);
const interval = setInterval(() => {

if (lightdm && lightdm.languages) {
if (lightdm in window && typeof lightdm.languages === "object") {
clearInterval(interval);
clearTimeout(timeout);
return init();
Expand Down

0 comments on commit bf231dd

Please sign in to comment.