Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jamxu88 authored Jun 21, 2021
1 parent aa1a60f commit 51b8f56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ <h1 style="text-align:center">hi go take a break now</h1>
window.close()
}
}, 100);
socket.on('close', () => {window.close()})
</script>
</body>

Expand Down
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,25 @@ app.use(express.static(__dirname));

io.on('connection', async (socket) => {
socket.on('disconnect', function(){
console.log('dcopen', active, unf)
if(active && !socket.connected) bopen("http://localhost:8899");
});
socket.on('unfocused', () => {
unf = true;
console.log('ufopen', active, unf)
if(active && !socket.connected) bopen("http://localhost:8899");
unf = false;
})
})

async function main() {
console.log("Starting break at")
console.log(new Date())
bopen("http://localhost:8899")
active = true;
await delay(300000);
await delay(3000);
console.log("Ending break at")
console.log(new Date())
active = false;
io.emit('close')
await delay(2400000);
main()
}
Expand Down

0 comments on commit 51b8f56

Please sign in to comment.