Expected Behavior
When I GM_registerMenuCommand and GM_unregisterMenuCommand with autoClose set to false, the menu commands should be updated immediately.
Actual Behavior
The update is not reflected until I re-open the Tampermonkey popup, rendering autoClose useless.
Specifications
- Chromium: Edge 130.0.2849.56
- TM: 5.3.6216
- OS: Windows 23H2
Script
// ==UserScript==
// @name Test menu commands
// @namespace http://tampermonkey.net/
// @version DEBUG
// @description try to take over the world!
// @author PRO-2684
// @match https://www.tampermonkey.net/*
// @icon http://tampermonkey.net/favicon.ico
// @license gpl-3.0
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// ==/UserScript==
(function() {
'use strict';
let cnt = 0;
const autoClose = false;
const id = GM_registerMenuCommand(`Count: ${cnt}`, update, { autoClose });
function update() {
cnt++;
GM_registerMenuCommand(`Count: ${cnt}`, update, { id, autoClose });
};
const unregId = GM_registerMenuCommand("Self-Unregister", () => {
GM_unregisterMenuCommand(unregId);
}, { autoClose });
})();
In either case, re-opening Tampermonkey popup is required in order to see the updated menu.
Expected Behavior
When I
GM_registerMenuCommandandGM_unregisterMenuCommandwithautoCloseset tofalse, the menu commands should be updated immediately.Actual Behavior
The update is not reflected until I re-open the Tampermonkey popup, rendering
autoCloseuseless.Specifications
Script
In either case, re-opening Tampermonkey popup is required in order to see the updated menu.