Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
MascheroniNatan committed Oct 24, 2024
1 parent 2bfc54c commit d3af90d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@

<script>
// Mostra un alert con la posizione dell'utente
document.querySelector('a-camera').addEventListener('gps-camera-update-position', function (event) {
const camera = document.querySelector('a-camera');
camera.addEventListener('gps-camera-update-position', function (event) {
console.log("Evento rilevato:", event);
const { latitude, longitude } = event.detail.position;
alert(`La tua posizione è:\nLatitudine: ${latitude}\nLongitudine: ${longitude}`);
});

camera.addEventListener('gps-camera-error', function (error) {
console.error("Errore GPS:", error);
});
</script>
</body>
</html>

0 comments on commit d3af90d

Please sign in to comment.