| 36 | debounce_s_{debounce_s} {} |
| 37 | |
| 38 | void SettingsSaver::update(const AppSettings& live, double now_s) { |
| 39 | if (!(live == current_)) { |
| 40 | current_ = live; |
| 41 | dirty_ = true; |
| 42 | } |
| 43 | if (dirty_ && now_s - last_save_s_ >= debounce_s_) { |
| 44 | save_(current_); |
| 45 | dirty_ = false; |
| 46 | last_save_s_ = now_s; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void SettingsSaver::flush() { |
| 51 | if (dirty_) { |