Educational demo page for GyroPalm JavaScript SDK
// Define params later:
var gp = new GyroPalm();
// Instantiate with params:
var gp = new GyroPalm("yourAPIkey", "wearableID");
gp.enableVerbose(true); //Include to enable console log
// If you have provided API key:
gp.getWearables("", onEventReceived);
// no need to repeat the API key
// If you defined without params:
gp.getWearables("yourAPIkey", onEventReceived);
// If you have provided API key:
gp.getAccountInfo("", onEventReceived);
// no need to repeat the API key
// If you defined without params:
gp.getAccountInfo("yourAPIkey", onEventReceived);
// Equivalent of setEventCallback and setConnectionCallback
// You can set callbacks and then connect:
gp.connect("wearableID", onEventReceived, onConnection);
// If you have already defined callbacks, connect with wearableID:
gp.connect("wearableID");
// If you have already connected prior and want to re-connect:
gp.connect();
// Run "onEventReceived" callback when new msg
gp.addEventCallback(onEventReceived);
// Run "onConnection" callback when connected/disconnected
gp.addConnectionCallback(onConnection);
// Optional. If you want to retrieve verbose messages
gp.addVerboseCallback(onVerbose);
// Example functions to print out your callbacks:
function onEventReceived(obj) {
console.log(obj);
}
function onConnection(obj) {
console.log(obj);
}