Skip to content

Instantly share code, notes, and snippets.

@ToeJamson
Last active January 30, 2018 21:36
Show Gist options
  • Select an option

  • Save ToeJamson/b258604b4f2b625f67a48181a1ff270e to your computer and use it in GitHub Desktop.

Select an option

Save ToeJamson/b258604b4f2b625f67a48181a1ff270e to your computer and use it in GitHub Desktop.
cryptocurrency price tracker
function processRequest(e) {
if (xhr.readyState == 4 && xhr.status == 200) {
var response = JSON.parse(xhr.responseText);
pubnub.publish({
channel: 'bitcoin-feed',
message: {
eon: {
'BitCoin': response.BTC.USD.toFixed(2)
}
}
});
pubnub.publish({
channel: 'ether-feed',
message: {
eon: {
'Ether': response.ETH.USD.toFixed(2)
}
}
});
pubnub.publish({
channel: 'litecoin-feed',
message: {
eon: {
'LiteCoin': response.LTC.USD.toFixed(2)
}
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment