diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/idle-game.iml b/.idea/idle-game.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/idle-game.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b64d1aa --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/css/app.css b/css/app.css new file mode 100644 index 0000000..e69de29 diff --git a/index.html b/index.html new file mode 100644 index 0000000..01a7665 --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + Idle game + + + +
+ +
+ + + + + \ No newline at end of file diff --git a/js/app.js b/js/app.js new file mode 100644 index 0000000..c93d81b --- /dev/null +++ b/js/app.js @@ -0,0 +1,27 @@ +let IdleGame = { + data() { + return { + + } + }, + mounted() { + setInterval(heartBeat, 60000); + alert(getPastMinutes()); + }, + methods: { + + } +}; + +const heartBeat = () => { + localStorage.setItem('heartBeat', moment().toISOString()); +}; + +const getPastMinutes = () => { + let lastHeartBeat = localStorage.getItem('heartBeat') ?? moment(); + let minutesPast = Math.round(moment.duration(moment().diff(lastHeartBeat)).as('minutes')); + + return minutesPast > 0 ? minutesPast : 0; +}; + +const IdleGameInstance = Vue.createApp(IdleGame).mount('#game'); \ No newline at end of file