Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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