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

Long press Listener?

Hello, I'm trying to read when an element is held (instead of clicked). Something similar to

myElement.addEventListener("click", () => {
  console.log('I am clicked');
});

 But with a hold event instead. I tried

myElement.addEventListener("hold", () => {
  console.log('I am held');
});

But I'm assuming 'hold' isn't an actual event name.  Can someone help me out? Thanks!

Best Answer
0 Votes
3 REPLIES 3

You can fudge this using "mouse" events and keeping track of time for screen touches. Even then, it doesn't work well with clockfaces because the system now uses a long-touch to start the Clocks app. For a clockface, you might be better trying to implement a double-tap (again using time).

Peter McLennan
Gondwana Software
Best Answer

I'm developing an app thankfully. But yeah, I came across that as a solution, but was hoping something better was out there.

 

Hey Fitbit Devs: Can this be added to a future sdk release? Is it in the works?

Best Answer
0 Votes

You can use this node module and see if it works. I haven't tested this module out so if you have an an issue with this then leave an issue on the respiratory here. 

 

 

 

If this answer works please mark this post as a Best Answer.  ~ K.K Designs

Best Answer
0 Votes