added command to copy result stats to clipboard

This commit is contained in:
Miodec 2023-01-31 01:02:40 +01:00
parent 921aa94dc7
commit 888cf9f34e

View file

@ -96,6 +96,7 @@ import * as Settings from "../pages/settings";
import * as Notifications from "../elements/notifications";
import * as VideoAdPopup from "../popups/video-ad-popup";
import * as ShareTestSettingsPopup from "../popups/share-test-settings-popup";
import * as TestStats from "../test/test-stats";
Misc.getLayoutsList()
.then((layouts) => {
@ -399,6 +400,22 @@ export const commands: MonkeyTypes.CommandsSubgroup = {
alert(await caches.keys());
},
},
{
id: "copyResultStats",
display: "Copy result stats",
icon: "fa-cog",
visible: false,
exec: async (): Promise<void> => {
navigator.clipboard
.writeText(JSON.stringify(TestStats.getStats()))
.then(() => {
Notifications.add("Copied to clipboard", 1);
})
.catch((e) => {
Notifications.add("Failed to copy to clipboard: " + e, -1);
});
},
},
{
id: "joinDiscord",
display: "Join the Discord server",