MCPcopy Create free account
hub / github.com/GoogleChrome/samples / callback

Function callback

file-system-observer/observer.js:18–40  ·  view source on GitHub ↗
(records, observer)

Source from the content-addressed store, hash-verified

16}
17
18const callback = async (records, observer) => {
19 const icons = {
20 created: '✅',
21 appeared: '✅',
22 modified: '📝',
23 deleted: '🗑️',
24 disappeared: '🗑️',
25 };
26 for (const record of records) {
27 console.log(record);
28 if (record.changedHandle && record.changedHandle.name.endsWith('.crswap')) {
29 continue;
30 }
31 if (!record.changedHandle) {
32 continue;
33 }
34 logMessage(
35 `The ${record.changedHandle.kind} "${record.changedHandle.name}" ${['modified', 'deleted', 'created'].includes(record.type) ? 'was ' : ''}${
36 icons[record.type]
37 } ${record.type}`
38 );
39 }
40};
41
42(async () => {
43 const observer = new self.FileSystemObserver(callback);

Callers 15

removeRunDependencyFunction · 0.85
doCallbackFunction · 0.85
cbwrapFunction · 0.85
__xFuncFunction · 0.85
__xInverseAndStepFunction · 0.85
__xFinalAndValueFunction · 0.85
__xDestroyFunction · 0.85
sqlite3.jsFile · 0.85
withStoreFunction · 0.85
callRuntimeCallbacksFunction · 0.85
removeRunDependencyFunction · 0.85
callRuntimeCallbacksFunction · 0.85

Calls 2

logMessageFunction · 0.70
logMethod · 0.45

Tested by

no test coverage detected