Last active
January 30, 2018 21:36
-
-
Save ToeJamson/b258604b4f2b625f67a48181a1ff270e to your computer and use it in GitHub Desktop.
cryptocurrency price tracker
This file contains hidden or 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
| 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