(date, func)
| 4 | // So we need additional logic to handle large delays |
| 5 | |
| 6 | function runAtDate(date, func) { |
| 7 | const now = (new Date()).getTime(); |
| 8 | const then = date.getTime(); |
| 9 | const diff = Math.max((then - now), 0); |
| 10 | |
| 11 | //setTimeout limit is MAX_INT32=(2^31-1) |
| 12 | if (diff > 0x7FFFFFFF) { |
| 13 | setTimeout(function() { runAtDate(date, func);}, |
| 14 | 0x7FFFFFFF); |
| 15 | } |
| 16 | else { |
| 17 | setTimeout(func, diff); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | module.exports = { |
| 22 | runAtDate |
no outgoing calls
no test coverage detected
searching dependent graphs…