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

Reset View when display turns on or off

ANSWERED

I have a watchface with two views. The primary view shows the Date, Time, and limited stats. The secondary has a detailed progress report. I would like the watch to always "wake up" to the clock view. I was looking at the Display API and see the onChange property and addEventListener() method; but was not sure how to implement it.

Are there any examples using event listeners?

 

Thanks in advance!

Best Answer
1 BEST ANSWER

Accepted Solutions

Like this:

 

import { display } from "display";
display.onchange = function() { if (display.on) { // Screen is on } else { // Screen is off } }

View best answer in original post

Best Answer
2 REPLIES 2

Like this:

 

import { display } from "display";
display.onchange = function() { if (display.on) { // Screen is on } else { // Screen is off } }
Best Answer

That worked like a charm! Thanks

Best Answer
0 Votes