MCPcopy Create free account
hub / github.com/DenOfEquity/ersatzForge / appendContextMenuOption

Function appendContextMenuOption

javascript/contextMenus.js:42–59  ·  view source on GitHub ↗
(targetElementSelector, entryName, entryFunction)

Source from the content-addressed store, hash-verified

40 }
41
42 function appendContextMenuOption(targetElementSelector, entryName, entryFunction) {
43 var currentItems = menuSpecs.get(targetElementSelector);
44
45 if (!currentItems) {
46 currentItems = [];
47 menuSpecs.set(targetElementSelector, currentItems);
48 }
49 let newItem = {
50 id: targetElementSelector + "_" + uid(),
51 name: entryName,
52 func: entryFunction,
53 isNew: true
54 };
55
56 currentItems.push(newItem);
57 return newItem["id"];
58 }
59
60 function addContextMenuEventListener() {
61 if (eventListenerApplied) {
62 return;

Callers 1

contextMenus.jsFile · 0.85

Calls 3

uidFunction · 0.85
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected