6 changed files with 71 additions and 0 deletions
@ -0,0 +1,8 @@
@@ -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 |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<module type="WEB_MODULE" version="4"> |
||||
<component name="NewModuleRootManager"> |
||||
<content url="file://$MODULE_DIR$"> |
||||
<excludeFolder url="file://$MODULE_DIR$/temp" /> |
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" /> |
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" /> |
||||
</content> |
||||
<orderEntry type="inheritedJdk" /> |
||||
<orderEntry type="sourceFolder" forTests="false" /> |
||||
</component> |
||||
</module> |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="ProjectModuleManager"> |
||||
<modules> |
||||
<module fileurl="file://$PROJECT_DIR$/.idea/idle-game.iml" filepath="$PROJECT_DIR$/.idea/idle-game.iml" /> |
||||
</modules> |
||||
</component> |
||||
</project> |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>Idle game</title> |
||||
<link rel="stylesheet" href="css/app.css"> |
||||
</head> |
||||
<body> |
||||
<div id="game"> |
||||
|
||||
</div> |
||||
<script src="https://unpkg.com/vue@next"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment-with-locales.min.js"></script> |
||||
<script src="js/app.js"></script> |
||||
</body> |
||||
</html> |
@ -0,0 +1,27 @@
@@ -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'); |
Loading…
Reference in new issue