Created
September 21, 2015 19:03
-
-
Save pjazdzewski1990/9c3b83bb2f80de525130 to your computer and use it in GitHub Desktop.
This file contains 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
@JSExport | |
def main(target: html.Div): Unit = { | |
... | |
dom.setInterval(refreshTimeSummary(target) _, 600) | |
... | |
} | |
def format(d: Date) = s"${d.getHours()}:${d.getMinutes()}" | |
def refreshTimeSummary(target: html.Div)() = { | |
val timeNeeded: Int = thingsToDo.foldLeft(0)((x, y) => x + y.time) | |
val now: Date = new Date | |
val endDate = new Date(now.getTime() + timeNeeded*60000) | |
timeSummary.innerHTML = s"${format(now)} + ${timeNeeded} minutes on tasks = ${format(endDate)}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment