mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-10 15:46:04 +08:00
added command to copy result stats to clipboard
This commit is contained in:
parent
921aa94dc7
commit
888cf9f34e
1 changed files with 17 additions and 0 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Reference in a new issue