Last active
February 20, 2017 20:05
-
-
Save andreban/4c29b531e38c14f76b74c71856cec24d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The PM5 API returns a Promise when the connection is established. | |
// The WakeLock is acquired once a connection is established. | |
pm5.connect() | |
.then(() => { | |
screen.keepAwake = true; | |
//... | |
}); | |
// The API also provides a disconnect event. The WakeLock is released | |
// once the application is disconnected from the rowing machine. | |
pm5.addEventListener('disconnect', () => { | |
screen.keepAwake = false; | |
//... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment