MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / getData

Function getData

src/background/utils/db.js:461–474  ·  view source on GitHub ↗
({ id, ids, sizes })

Source from the content-addressed store, hash-verified

459 * @return {Promise<{ scripts: VMScript[], cache: Object }>}
460 */
461export 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.

Callers 2

augmentSetPopupFunction · 0.90
util-task.jsFile · 0.85

Calls 4

getScriptsByIdsOrAllFunction · 0.85
getSizesFunction · 0.85
getIconCacheFunction · 0.85
filterMethod · 0.80

Tested by

no test coverage detected