Suppose there is a list of items that, when clicked, triggers a function.
function func_1 {alert(1)}; function func_2 {alert(2)}; function func_3 {alert(3)}; ... chrome.contextMenus.create({"title": "item 1", "onclick": func_1}); chrome.contextMenus.create({"title": "item 2", "onclick": func_2}); chrome.contextMenus.create({"title": "item 3", "onclick": func_3}); ...
And what if there are 20 such points ??? Is it possible for each to create a separate function ???
I would like to know if it is possible to somehow represent all the items as an array ??? And is it possible to programmatically get the title of the item that was clicked on ???
The main goal: to combine all functions into one.