Both versions of this code add an event listener to a context menu item. I was wondering what the differences were, and why version 1 is always loading the popup 5x faster than version 2.
Version 1 (Fast):
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
id: "create-popup-from-page",
title: "Popup From Page",
contexts: ["all"],
});
});
chrome.contextMenus.onClicked.addListener((pageUrl) => {
createPopupFromUrl(pageUrl.pageUrl.toString());
});
Version 2 (Slow):
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
id: "create-popup-from-page",
title: "Popup From Page",
contexts: ["all"],
});
chrome.contextMenus.onClicked.addListener((pageUrl) => {
createPopupFromUrl(pageUrl.pageUrl.toString());
});
});