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

Function touch

src/background/utils/db.js:853–876  ·  view source on GitHub ↗
(prefix, id, scriptId, pathMap)

Source from the content-addressed store, hash-verified

851 ];
852 const downloadUrls = {};
853 const touch = (prefix, id, scriptId, pathMap) => {
854 if (!id || pathMap && isDataUri(id)) {
855 return 0;
856 }
857 const key = prefix + (pathMap?.[id] || id);
858 const val = status[key];
859 if (val < 0) {
860 status[key] = 1;
861 if (id !== scriptId) {
862 status[S_MOD_PRE + id] = 1;
863 }
864 if (prefix === S_VALUE_PRE) {
865 if ((sizes[key] = deepSize(data[key])) === 2) {
866 // remove empty {}
867 sizes[key] = 0;
868 status[key] = -1;
869 }
870 } else if (prefix !== S_MOD_PRE) {
871 sizes[key] = deepSize(data[key]) + key.length;
872 }
873 } else if (!val && !prefixIgnoreMissing.includes(prefix)) {
874 status[key] = 2 + scriptId;
875 }
876 };
877 if (!data) data = await storage.api.get();
878 data::forEachKey((key) => {
879 if (prefixRe.test(key)) {

Callers 1

vacuumFunction · 0.85

Calls 1

deepSizeFunction · 0.90

Tested by

no test coverage detected