| 76 | int64_t nextTimerID = 0; |
| 77 | |
| 78 | int64_t setTimeout (uint32_t interval) |
| 79 | { |
| 80 | auto timerID = ++nextTimerID; |
| 81 | |
| 82 | activeTimers[timerID] = choc::messageloop::Timer (interval, [this, timerID] |
| 83 | { |
| 84 | auto timeIDCopy = timerID; // local copy as this lambda will get deleted.. |
| 85 | activeTimers.erase (timeIDCopy); |
| 86 | |
| 87 | try |
| 88 | { |
| 89 | context.invoke ("_choc_invokeTimeout", timeIDCopy); |
| 90 | } |
| 91 | catch (const choc::javascript::Error& e) |
| 92 | { |
| 93 | std::cerr << e.what() << std::endl; |
| 94 | } |
| 95 | |
| 96 | return false; |
| 97 | }); |
| 98 | |
| 99 | return timerID; |
| 100 | } |
| 101 | |
| 102 | int64_t setInterval (uint32_t interval) |
| 103 | { |
no test coverage detected