(options = {})
| 190 | } |
| 191 | |
| 192 | async function refreshAccountsView(options = {}) { |
| 193 | const refreshStats = options.refreshStats !== false; |
| 194 | const refreshList = options.refreshList !== false; |
| 195 | const settleDelayMs = Math.max(0, Number(options.settleDelayMs || 0)); |
| 196 | const tasks = []; |
| 197 | |
| 198 | if (settleDelayMs > 0) { |
| 199 | await delay(settleDelayMs); |
| 200 | } |
| 201 | |
| 202 | if (refreshStats) { |
| 203 | if (!pendingAccountStatsRefresh) { |
| 204 | pendingAccountStatsRefresh = loadStats().finally(() => { |
| 205 | pendingAccountStatsRefresh = null; |
| 206 | }); |
| 207 | } |
| 208 | tasks.push(pendingAccountStatsRefresh); |
| 209 | } |
| 210 | |
| 211 | if (refreshList) { |
| 212 | if (!pendingAccountListRefresh) { |
| 213 | pendingAccountListRefresh = loadAccounts().finally(() => { |
| 214 | pendingAccountListRefresh = null; |
| 215 | }); |
| 216 | } |
| 217 | tasks.push(pendingAccountListRefresh); |
| 218 | } |
| 219 | |
| 220 | if (tasks.length > 0) { |
| 221 | await Promise.all(tasks); |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | // DOM 元素 |
| 226 | const elements = { |
no test coverage detected