01-23-2019 00:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2019 00:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Is there any documentation about the `repl device` command available inside the CLI?
repl device Enter into a REPL with the connected device
I was not able to find any clues by using `fitbit$ repl$ console.log(Object.keys(this))`
Thanks!
Answered! Go to the Best Answer.

Accepted Solutions
01-23-2019 05:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2019 05:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Is there an example on how to do that?
It looks like import is not available, but I can use 'require'... so I am good to go. Thanks!
fitbit$ repl device Entering REPL mode, type "exit" to quit
fitbit$ repl$ var document = require('document')
undefined
fitbit$ repl$ document.getElementById('vibration-list')
[object Object]
fitbit$ repl$ var vibration = require('haptics').vibration
01-23-2019 02:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-23-2019 02:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
At this time, I beleive it only works with the simulator. But the device version should ship in the next firmware update.

01-23-2019 04:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2019 04:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
> At this time, I beleive it only works with the simulator. But the device version should ship in the next firmware update.
Thanks!
Yes, it only works with the simulator...but how can it be used?
What can one do with the REPL.

01-23-2019 05:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-23-2019 05:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
You should be able to move elements around on screen, update colors, change variables etc, without having to reinstall the app.
01-23-2019 05:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2019 05:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Is there an example on how to do that?
It looks like import is not available, but I can use 'require'... so I am good to go. Thanks!
fitbit$ repl device Entering REPL mode, type "exit" to quit
fitbit$ repl$ var document = require('document')
undefined
fitbit$ repl$ document.getElementById('vibration-list')
[object Object]
fitbit$ repl$ var vibration = require('haptics').vibration
01-23-2019 05:56
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-23-2019 05:56
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Those really should be imported in your app already during the build process. repl should be used for manipulating the existing app, not development of the app.

01-23-2019 06:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2019 06:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for the info.
For some reason, I don't have the app objects loaded in the repl... this is why at first I was not sure if repl is functional.

01-31-2019 10:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



01-31-2019 10:41
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
They'll be there, but not under the names you might expect. When you build your app, the code gets minified using Terser, and a function name like "myAwesomeFunc" gets mangled into "a" to save memory.
02-01-2019 13:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-01-2019 13:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
What I also find usefully is to check an existence of certain JS functions. Sometimes I forget that device supports the ES5 syntax only. So there is on implementation of Object.values for instance. So one of the usageu example is a quick check if your function will work or not.

02-01-2019 15:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-01-2019 15:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Is there a way to disable name mangling ?
or is there a source map?
How are we supposed to use the repl and for which tasks ? 🙂
Thanks!

02-01-2019 15:22 - edited 02-01-2019 15:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-01-2019 15:22 - edited 02-01-2019 15:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I think the source maps are in your app.fba, which is just a .zip file. Look for *.js.map files. They look like JSON to me. I haven't fully reverse-engineered them, but they don't look too cryptic.
The minification is probably done by an open-source tool for which online documentation exists. More clues may be available here.
Gondwana Software
