(
callback:Function,
interval:number = 1000,
repeatCount:number = 1)
| 119 | * @return {number} indicator of interval to allow cancelling |
| 120 | */ |
| 121 | export function interval( |
| 122 | callback:Function, |
| 123 | interval:number = 1000, |
| 124 | repeatCount:number = 1):number{ |
| 125 | |
| 126 | if (repeatCount === 0) { |
| 127 | return Runtime.getTimer().setInterval(callback, interval); |
| 128 | } |
| 129 | var ivl = Runtime.getTimer().setInterval(function(){ |
| 130 | repeatCount--; |
| 131 | if (repeatCount < 0) { |
| 132 | Runtime.getTimer().clearInterval(ivl); |
| 133 | } else { |
| 134 | callback(); |
| 135 | } |
| 136 | }, interval); |
| 137 | return ivl; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Clears a scheduled timeout. If timeout id is not recognized no action |
nothing calls this directly
no test coverage detected