-
Hi, i have two doubts: The first is about timer, according with the official documentation I just have to use this function in order to create a timer but when i add to my code i receive the warning: Could not find name 'timer', am I missing a file to import? //Create timer, delay 500ms to trigger, then execute every 1000ms.
const timer1 = timer.createTimer(
500,
1000,
function (option) {
//callback
console.log('timer callback')
console.log(option.hour)
},
{ hour: 0, minute: 15, second: 30 }
)
//Stop timer1
timer.stopTimer(timer1) And the second is about the gesture event the example code works great but the event apply in all pages and i want to know if there's a way to make that just affect one page. Thanks. My device is amazfit band 7 system version: 1.10.58.1 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I can suggest you of timer. I am a beginner so I don't really know ok. So don't just blind trust on me. I think you need to add the stop timer code as well. Like by creating a button to stop the time maybe that would work . Again I am just a beginner |
Beta Was this translation helpful? Give feedback.
-
Hello For the first question, I was not able to reproduce it due to insufficient clues, could you provide the relevant code snippet. The If The second issue is that we need to use the |
Beta Was this translation helpful? Give feedback.
Hello
For the first question, I was not able to reproduce it due to insufficient clues, could you provide the relevant code snippet. The
timer
is not needed to be introduced, the code in the documentation can be used directly.If
timer
is not working, it is recommended to usesetTimeout
andsetInterval
instead.The second issue is that we need to use the
unregisterGestureEvent
API to unregister gesture events when we leave the page.