MCPcopy
hub / github.com/Tampermonkey/tampermonkey / write

Function write

src/background.js:1237–1267  ·  view source on GitHub ↗
(progress, fn, obj, cb)

Source from the content-addressed store, hash-verified

1235 };
1236
1237 var write = function(progress, fn, obj, cb) {
1238 if (obj.length) {
1239 TM_fire.resetStatus();
1240 TM_fire.status.update = true;
1241 TM_fire.status.action = I18N.getMessage('Writing_scripts');
1242 TM_fire.status.progress = { n: progress, of: writeInc.length + writeExc.length + writeSInc.length + writeSExc.length };
1243 } else {
1244 if (cb) cb();
1245 return;
1246 }
1247
1248 var runAgain = function () {
1249 write(progress, fn, obj, cb);
1250 };
1251
1252 var writeDone = function() {
1253 if (j >= obj.length - 1) {
1254 if (cb) cb();
1255 } else {
1256 window.setTimeout(runAgain, 0);
1257 }
1258 };
1259
1260 var end = obj.length - 1;
1261 if ((end - j) > bulk) end = j + bulk;
1262 if (D) console.log("bg: write TF " + end);
1263
1264 fn(obj.slice(j, end), writeDone);
1265 j = end;
1266 TM_fire.status.progress.n = progress + j;
1267 };
1268
1269 var writeScripts = function(cb) {
1270 if (scripts.length) {

Callers 5

runAgainFunction · 0.70
siDoneFunction · 0.70
eDoneFunction · 0.70
iDoneFunction · 0.70
sDoneFunction · 0.70

Calls 1

cbFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…