Skip to content

Instantly share code, notes, and snippets.

@gemma-vincent
Last active January 29, 2018 15:52
Show Gist options
  • Save gemma-vincent/21468515ec52505ddb198b06dd662ed6 to your computer and use it in GitHub Desktop.
Save gemma-vincent/21468515ec52505ddb198b06dd662ed6 to your computer and use it in GitHub Desktop.
//Connects to the socket
const socket = io('https://9b547253.ngrok.io');
let data = new Array();
//Once we are connected do this shit
socket.on('instantPower', function(instantPower) {
console.log(instantPower);
data.push(instantPower);
if ( data.length > 10 ) {
data = data.slice(1, 11);
}
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment