| 408 | } |
| 409 | |
| 410 | struct Timer { |
| 411 | int64_t id; |
| 412 | tsn_vm* ctx; |
| 413 | tsn_value_const func; |
| 414 | std::vector<tsn_value_const> args; |
| 415 | |
| 416 | void dispose() { |
| 417 | JS_FreeValue(ctx, func); |
| 418 | for (auto& arg : args) { |
| 419 | JS_FreeValue(ctx, arg); |
| 420 | } |
| 421 | } |
| 422 | }; |
| 423 | static int64_t next_timer_id = 0; |
| 424 | static std::multimap<std::chrono::steady_clock::time_point, Timer> active_timers; |
| 425 |