Created
March 30, 2018 04:32
-
-
Save radislaw/13ed0b6a80026c80858f9384b3a60ae4 to your computer and use it in GitHub Desktop.
log to console page loaded time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getCurrentTime() { | |
| const date = new Date(); | |
| let h = date.getHours(); | |
| let m = date.getMinutes(); | |
| let s = date.getSeconds(); | |
| h = h < 10 ? `0${h}` : h; | |
| m = m < 10 ? `0${m}` : m; | |
| s = s < 10 ? `0${s}` : s; | |
| return `${h}:${m}:${s}`; | |
| } | |
| console.log(`%c Страница обновлена в %c ${getCurrentTime()} %c`, | |
| "background:#F39C12; padding: 5px; border-radius: 3px 0 0 3px; color: #fff; font-size: 16px", | |
| "background:#E74C3C; padding: 5px; border-radius: 0 3px 3px 0; color: #fff; font-weight: bold; font-size: 16px", | |
| "background:transparent"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment