({ id, ids, sizes })
| 459 | * @return {Promise<{ scripts: VMScript[], cache: Object }>} |
| 460 | */ |
| 461 | export async function getData({ id, ids, sizes }) { |
| 462 | if (id) ids = [id]; |
| 463 | const res = {}; |
| 464 | const scripts = ids |
| 465 | // Some ids shown in popup/editor may have been hard-deleted |
| 466 | ? getScriptsByIdsOrAll(ids).filter(Boolean) |
| 467 | : getScriptsByIdsOrAll(); |
| 468 | scripts.forEach(inferScriptProps); |
| 469 | res[SCRIPTS] = scripts; |
| 470 | if (sizes) res.sizes = getSizes(ids); |
| 471 | if (!id) res.cache = await getIconCache(scripts); |
| 472 | if (!id && sizes) res.sync = commands.SyncGetStates(); |
| 473 | return res; |
| 474 | } |
| 475 | |
| 476 | /** |
| 477 | * Returns only own icon and the already cached icons. |
no test coverage detected