Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@mturco/context-menu
Advanced tools
A small JavaScript library for adding context menus to any HTML element
A small (4.4kb / 1.7kb gzipped) JavaScript library for adding context menus to any HTML element.
npm install @mturco/context-menu
new ContextMenu(selector, items[, options]);
selector
(String) - Show context menus for elements matching this selectoritems
(Array) - Array of menu items objects in the format of:
name
(String) - Label displayed for menu itemfn
(Function) - onclick
event handler for menu item{}
) in the items
array.options
(Object)
className
(String, default: ''
) - CSS class to add to the context menu elementminimalStyling
(Boolean, default: false
) - If true, does not apply default theme CSS class to context menu elementContextMenu.prototype.on(type, listener);
ContextMenu.prototype.off(type, listener);
type
(String) - Event type; one of: created
, shown
, hidden
, itemselected
listener
(Function) - Callback for event listenerRemoves DOM elements and event listeners.
import ContextMenu from 'context-menu';
const menu = new ContextMenu('table tr', [
{
name: 'Add row',
fn: () => {
/* ... */
},
},
{
name: 'Remove row',
fn: () => {
/* ... */
},
},
]);
menu.on('itemselected', () => {
/* ... */
});
FAQs
A small JavaScript library for adding context menus to any HTML element
We found that @mturco/context-menu demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.