Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (38 sloc) 768 Bytes
print = global.print
p = global.prettyPrint
require = global.require
throw = (err) {
p(err)
global.exit()
}
// Used to emit on errors when libuv badness happens
check = (status) {
if (status) {
throw(require('uv').lastError())
}
}
Timer = require('timer')
p("Timer", Timer)
timer = Timer.create()
timer2 = Timer.create()
p("timer", timer)
p("timer2", timer2)
check(timer:start(1000, 0, () {
p("onTimeout", timer)
check(timer2:stop())
check(timer:stop())
timer:close(() {
p("close", timer)
})
timer2:close(() {
p("close2", timer2)
})
}))
check(timer2:start(0, 150, () {
p("onInterval", timer2)
period = timer2:getRepeat()
p("period", period)
timer2:setRepeat(period / 1.2 + 2)
}))
p("timer", timer)
p("timer2", timer2)