/**
* @type {ContextMenu}
* @private
*/
_contextMenu = undefined;
// Show
this._contextMenu.render(this.element);
// Hide
this._contextMenu.close({ animate: true });
// In activateListeners
const menuItems = [{
name: "a localized text",
icon: "either an empty string, or an icon element in raw HTML",
condition: () => { return true; }, // If this returns true, the menu item will be visible.
callback: () => { doStuff(); } // The actual callback that gets invoked when the menu item is clicked.
}];
this._contextMenu = new ContextMenu(html, this.id, menuItems);
Show respective context menus on right click on items.
See also: https://foundryvtt.com/api/ContextMenu.html