Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Commit

Permalink
Move to new src structure
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIPv4 committed Jul 11, 2019
1 parent 108b1f7 commit e101a7c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 0 additions & 4 deletions index.html

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "room-tablet",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "src/index.js",
"scripts": {
"start": "electron index.js"
"start": "electron src/index.js"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const tablet = require('./tablet/tablet.js');
4 changes: 4 additions & 0 deletions src/tablet/screen.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<html>
<head></head>
<body><script src="screen.js"></script></body>
</html>
File renamed without changes.
15 changes: 7 additions & 8 deletions index.js → src/tablet/tablet.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ const createWindow = () => {
alwaysOnTop: true,
backgroundColor: "#000"
});
mainWindow.loadFile('index.html');

displayOff();
setTimeout(() => {
setStyleAndText(2, "Hello!");
}, 5000);
mainWindow.loadFile(`${__dirname}/screen.html`);
};

const displayOn = () => {
Expand All @@ -33,9 +28,11 @@ const allowSleep = () => {
stayAwake.allow();
};

const setStyleAndText = (style, large, small) => {
displayOn();
const setStyle = style => {
mainWindow.webContents.executeJavaScript(`applyBoxStyle(${style});`);
};

const setText = (large, small) => {
mainWindow.webContents.executeJavaScript(`setText("${large}", "${small || ""}");`);
};

Expand All @@ -48,3 +45,5 @@ app.on('before-quit', () => {
displayOn();
allowSleep();
});

module.exports = {displayOn, displayOff, setStyle, setText};

0 comments on commit e101a7c

Please sign in to comment.