Fix svelte error

Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
Gregoire Parant 2021-12-23 14:52:42 +01:00
parent df3c618ffa
commit 96d46e96c2

View File

@ -7,9 +7,9 @@
} }
const myNavigator : ExtNavigator = window.navigator; const myNavigator : ExtNavigator = window.navigator;
const haveNavigatorSharingFeature = myNavigator && myNavigator.canShare && myNavigator.share; const haveNavigatorSharingFeature:boolean = myNavigator && myNavigator.canShare != null && myNavigator.share != null;
let copied = false; let copied:boolean = false;
function copyLink() { function copyLink() {
try { try {
@ -48,14 +48,14 @@
<p>Share the link of the room!</p> <p>Share the link of the room!</p>
</section> </section>
<section> <section>
{#if $haveNavigatorSharingFeature} {#if haveNavigatorSharingFeature}
<input type="hidden" readonly id="input-share-link" value={location.toString()} /> <input type="hidden" readonly id="input-share-link" value={location.toString()} />
<button type="button" class="nes-btn is-primary" on:click={shareLink}>Share</button> <button type="button" class="nes-btn is-primary" on:click={shareLink}>Share</button>
{:else} {:else}
<input type="text" readonly id="input-share-link" value={location.toString()} /> <input type="text" readonly id="input-share-link" value={location.toString()} />
<button type="button" class="nes-btn is-primary" on:click={copyLink}>Copy</button> <button type="button" class="nes-btn is-primary" on:click={copyLink}>Copy</button>
{/if} {/if}
{#if $copied} {#if copied}
<p>Copied!</p> <p>Copied!</p>
{/if} {/if}
</section> </section>