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

Function flush

src/background/utils/storage-cache.js:185–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

183}
184
185async function flush() {
186 const keys = Object.keys(valuesToFlush);
187 const toRemove = [];
188 const toFlush = valuesToFlush;
189 valuesToFlush = {};
190 flushTimer = 0;
191 keys.forEach(key => {
192 const val = toFlush[key];
193 if (!val) {
194 delete toFlush[key];
195 toRemove.push(key);
196 }
197 updateScriptSizeContributor(key, val);
198 });
199 if (!isEmpty(toFlush)) await api.set(toFlush);
200 if (toRemove.length) await api.remove(toRemove);
201 if (valuesToWatch) setTimeout(notifyWatchers, 0, toFlush, toRemove);
202}
203
204function flushLater() {
205 if (!flushTimer && !isEmpty(valuesToFlush)) {

Callers

nothing calls this directly

Calls 4

isEmptyFunction · 0.90
setMethod · 0.80
removeMethod · 0.80

Tested by

no test coverage detected