Skip to content

Instantly share code, notes, and snippets.

@hgale
Created March 19, 2017 20:47
Show Gist options
  • Save hgale/191573a32ff59e1f145bb92dab6ddf33 to your computer and use it in GitHub Desktop.
Save hgale/191573a32ff59e1f145bb92dab6ddf33 to your computer and use it in GitHub Desktop.
import pole from 'pole'
this.setState({
pollLocation: pole({interval:
LOCATION_POLL_FREQUENCY}, (
callback) => {
let now = new Date()
let data = JSON.stringify({'lat': 20,
'long': 20, 'time': now })
fetch('http://localhost:8080', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: data
})
this.updateTime(now)
callback()
})
}) Copy-paste code here to remove the line numbers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment