Understanding invalidateLater(ms)

Increment a cumulative sum with a random number

sum <- reactiveVal(0)
observe({
  invalidateLater(300)
  sum(isolate(sum()) + runif(1))
})