Add functionality to the Copy Game Link button

This commit is contained in:
Oliver Akins 2022-03-15 23:25:27 -06:00
parent 05a5bfc3af
commit 7d39b41b6d
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99

View file

@ -34,6 +34,11 @@ const modal = {
$: visibleOptions = gameOptions.filter(x => !x.hidden);
/** Copies the game link to clipboard for easy sharing */
function copyLinkToClipboard() {
navigator.clipboard.writeText(window.location.href);
};
/**
* What gets called when the host toggles one of the options in the lobby so
* that the other players can see the change happen on their screen.
@ -62,7 +67,7 @@ function toggleOption(e: CustomEvent<string>) {
<h1>Gravwell</h1>
<SciFiButton
width="69%"
on:click={tempButtonHandler}
on:click={copyLinkToClipboard}
>
Copy Game Link
</SciFiButton>