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

Function broadcast

src/background/utils/values.js:112–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110}
111
112async function broadcast() {
113 const toTabs = {};
114 let num = 0;
115 toSend::forEachEntry(groupByTab, toTabs);
116 toSend = {};
117 for (const [tabId, frames] of Object.entries(toTabs)) {
118 for (const [frameId, toFrame] of Object.entries(frames)) {
119 if (!isEmpty(toFrame)) {
120 // Not awaiting because the tab may be busy/sleeping
121 sendTabCmd(+tabId, 'UpdatedValues', toFrame, getFrameDocIdAsObj(frameId));
122 if (!(++num % 20)) await makePause(); // throttling
123 }
124 }
125 }
126}
127
128/** @this {Object} accumulator */
129function groupByTab([id, valuesToSend]) {

Callers

nothing calls this directly

Calls 4

isEmptyFunction · 0.90
sendTabCmdFunction · 0.90
getFrameDocIdAsObjFunction · 0.90
makePauseFunction · 0.90

Tested by

no test coverage detected