Fix flashing of unset time and styles.

This commit is contained in:
John Espiritu 2021-08-08 19:51:56 +08:00
parent ccc2d6a9c7
commit ea72877840
2 changed files with 7 additions and 7 deletions

12
dist/app.js vendored
View File

@ -1,9 +1,4 @@
var second = document.getElementById('second'); var second, minute, hour, dow, day;
var minute = document.getElementById('minute');
var hour = document.getElementById('hour');
var dow = document.getElementById('dow');
var day = document.getElementById('day');
var DAY_OF_WEEK = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']; var DAY_OF_WEEK = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];
function getRotation60Deg(value) { function getRotation60Deg(value) {
@ -35,6 +30,11 @@ function render() {
} }
window.onload = function () { window.onload = function () {
second = document.getElementById('second');
minute = document.getElementById('minute');
hour = document.getElementById('hour');
dow = document.getElementById('dow');
day = document.getElementById('day');
render(); render();
setInterval(render, 16); setInterval(render, 16);
setTimeout(function () { setTimeout(function () {

2
dist/index.html vendored
View File

@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./style.css"> <link rel="stylesheet" href="./style.css">
<title>Analog Clock</title> <title>Analog Clock</title>
<script src="./app.js"></script>
</head> </head>
<body> <body>
<div id="clock"> <div id="clock">
@ -35,6 +36,5 @@
<footer> <footer>
2021 &copy; <a href="https://johnespiritu.dev" target="_blank">John Espiritu</a> 2021 &copy; <a href="https://johnespiritu.dev" target="_blank">John Espiritu</a>
</footer> </footer>
<script src="./app.js"></script>
</body> </body>
</html> </html>