Skip to content

Instantly share code, notes, and snippets.

@benwaffle
Created August 19, 2016 17:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benwaffle/c61d0fb29ced1f7bacdfdd4dc28229fd to your computer and use it in GitHub Desktop.
Save benwaffle/c61d0fb29ced1f7bacdfdd4dc28229fd to your computer and use it in GitHub Desktop.
socket.on('new_turn', data => {
fetch(`https://maps.googleapis.com/maps/api/geocode/json?address="${data.city}, ${data.country}"`)
.then(res => res.json())
.then(data => {
const loc = data.results[0].geometry.location
createMarker(loc.lat, loc.lng, 'blue')
socket.emit('answer', gameId, loc.lat, loc.lng)
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment