Skip to content

Instantly share code, notes, and snippets.

@andreban
Last active February 20, 2017 20:05
Show Gist options
  • Save andreban/4c29b531e38c14f76b74c71856cec24d to your computer and use it in GitHub Desktop.
Save andreban/4c29b531e38c14f76b74c71856cec24d to your computer and use it in GitHub Desktop.
// 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