Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Full Documentation of Device object?

Is there someplace else I should be looking for full documentation of methods and properties other than: https://dev.fitbit.com/build/reference/device-api/  ??


For instance, I was doing the first clock example and looking at the Clock API at

https://dev.fitbit.com/build/reference/device-api/clock/

And the TickEvent has only a single property of 'date'.

And this date property has only four methods listed:

getMilliseconds, getSeconds, getMinutes, getHours

However, if I print the entire evt.date from the TickEvent, I get a whole lot more info

including full date, day of week, offset from GMT, etc.

Where are these additional items documented and are there methods to access the

individual items?

 

Also, the documentation for 'clock' has an addEventListener method which is needed to get notified that a tick happened. However, the clock example does not do this, so this must be magic done behind the scenes?

 

And the Tutorials have not been created, or am I looking in the wrong place:

https://dev.fitbit.com/build/tutorials/

TIA!

Best Answer
0 Votes
2 REPLIES 2

The device runs ES 5.1 JavaScript, so you can use any of that standard JavaScript code within your app index.js. https://www.ecma-international.org/ecma-262/5.1/

 

For example, here's some documentation about the Date object https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

 

With events in JavaScript you can use element.addEventListener("event-name",...  or you can do element.onEventName = function() .... The digital clock project uses a shorthand syntax of the latter example called arrow functions. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

 

Tutorials are still WIP, sorry.

Best Answer

So I can use any of the methods mentioned in the pointer to the Date object? They're all implemented in the ionic? And all of the ES 5.1 JS is in there? Wow.

Best Answer
0 Votes