MCPcopy Index your code
hub / github.com/Tampermonkey/tampermonkey / storeScript

Function storeScript

src/background.js:3739–3770  ·  view source on GitHub ↗
(name, script, triggerSync)

Source from the content-addressed store, hash-verified

3737};
3738
3739var storeScript = function(name, script, triggerSync) {
3740 if (triggerSync === undefined) triggerSync = true;
3741
3742 if (script) {
3743 var added = !TM_storage.getValue(name);
3744 var changed;
3745
3746 TM_storage.setValue(name + condAppendix, { inc: script.includes, match: script.matches, exc: script.excludes });
3747 TM_storage.setValue(name + scriptAppendix, script.textContent);
3748 var s = script;
3749 s.textContent = null;
3750 TM_storage.setValue(name, s);
3751
3752 if (triggerSync) {
3753 if (added) {
3754 SyncClient.scriptAddedCb(name, script);
3755 } else {
3756 SyncClient.scriptChangedCb(name, script);
3757 }
3758 }
3759 } else {
3760 var r = loadScriptByName(name);
3761
3762 TM_storage.deleteValue(name + condAppendix);
3763 TM_storage.deleteValue(name + scriptAppendix);
3764 TM_storage.deleteValue(name);
3765
3766 if (triggerSync && r.script && r.cond) {
3767 SyncClient.scriptRemovedCb(name, r.script);
3768 }
3769 }
3770};
3771
3772var notifyStorageListeners = function(name, key, tabid, send) {
3773 if (send === undefined) send = true;

Callers 8

timeFunction · 0.85
convertDataFunction · 0.85
impoFunction · 0.85
removeUserScriptFunction · 0.85
doitFunction · 0.85
updateHashFunction · 0.85
reorderScriptsFunction · 0.85
background.jsFile · 0.85

Calls 1

loadScriptByNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…