diff --git a/Century Gothic.ttf b/Century Gothic.ttf new file mode 100644 index 0000000..c60a324 Binary files /dev/null and b/Century Gothic.ttf differ diff --git a/index.html b/index.html index c598b51..2ee4e35 100644 --- a/index.html +++ b/index.html @@ -1,19 +1,25 @@

hi go take a break now

+

@@ -28,6 +34,9 @@

hi go take a break now

} }, 100); socket.on('close', () => {window.close()}) + socket.on('time', (t) => { + document.getElementById('timer').innerText = "Time left: " + t + " seconds."; + }) diff --git a/index.js b/index.js index 8dcd964..622a9e3 100644 --- a/index.js +++ b/index.js @@ -7,6 +7,8 @@ const delay = require('delay'); var active = false; var unf = false; +var stime; +var tleft; http.listen(8899, async () => { }) @@ -30,11 +32,19 @@ io.on('connection', async (socket) => { async function main() { console.log("Starting break at") - console.log(new Date()) + stime = new Date() + console.log(stime); + tleft = 120 + var intv = setInterval(function x() { + console.log(tleft) + io.emit('time',tleft) + tleft -= 1; + if(tleft == 0) clearInterval(intv) + },1000) bopen("http://localhost:8899") active = true; await delay(120000); - console.log("Ending break at") + console.log("Break ended at") console.log(new Date()) active = false; io.emit('close') diff --git a/package.json b/package.json index 1b78dec..6d769f6 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.0", "description": "", "main": "index.js", + "bin": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, @@ -14,5 +15,9 @@ "express": "^4.17.1", "http": "0.0.1-security", "socket.io": "^4.1.2" + }, + "pkg": { + "assets": ["/index.html", "/socket.io.js", "/Century Gothic.ttf"], + "targets": ["node12-win-x64"] } }