07-23-2023 01:27 - edited 07-23-2023 01:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-23-2023 01:27 - edited 07-23-2023 01:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm moving a clockface I developed in Studio into a local node.js project.
I'm getting the following error:
App: Unhandled exception: TypeError: Expected a function.
? at app/index.js:14,7
`document` is clearly defined, so I'm baffled by this.
I tried the basic Fitbit example at https://dev.fitbit.com/getting-started/ and it has the same issue. This is a Versa 2 project using SDK ~4.3.0 with "mira" as the target.
import clock from "clock";
import * as document from "document";
import { preferences } from "user-settings";
import * as util from "../resources/utils";
import { HeartRateSensor } from "heart-rate";
import { me as appbit } from "appbit";
import { today as toDay } from "user-activity";
import { battery } from "power";
// update the clock every minute
clock.granularity = "minutes";
// THE PROBLEM IS HERE
const theTime = document.getElementById("theTime");

07-23-2023 01:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


07-23-2023 01:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
This is a long-shot, but just try:
import document from 'document'
Gondwana Software
07-23-2023 02:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-23-2023 02:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
07-23-2023 02:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


07-23-2023 02:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
That was my theory; I didn't want to lead with it in case I was mistaken!
Gondwana Software
