{"html_url": "https://github.com/simonw/datasette/issues/983#issuecomment-753600999", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/983", "id": 753600999, "node_id": "MDEyOklzc3VlQ29tbWVudDc1MzYwMDk5OQ==", "user": {"value": 475613, "label": "MarkusH"}, "created_at": "2021-01-03T11:11:21Z", "updated_at": "2021-01-03T11:11:21Z", "author_association": "NONE", "body": "With regards to JS/Browser events, given your example of menu items that plugins could add, I could imagine this code to work:\r\n\r\n```js\r\n// as part of datasette\r\ndatasette.events.AddMenuItem = 'DatasetteAddMenuItemEvent';\r\ndocument.addEventListener(datasette.events.AddMenuItem, (e) => {\r\n // do whatever is needed to add the menu item. Data comes from `e`\r\n alert(e.title + ' ' + e.link);\r\n});\r\n\r\n// as part of a plugin\r\nconst event = new Event(datasette.events.AddMenuItem, {link: '/foo/bar', title: 'Go somewhere'});\r\nDocument.dispatchEvent(event)\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 712260429, "label": "JavaScript plugin hooks mechanism similar to pluggy"}, "performed_via_github_app": null}