Created
March 19, 2017 20:47
-
-
Save hgale/191573a32ff59e1f145bb92dab6ddf33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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