In some scenarios, we may need to control the machine or block the machine from entering into sleep mode. For example, if you are developing a media player application, the system should not go to sleep mode when playing a video, or your app should never turn off the power when playing the audio. Electron's powerSaveBlocker
module gives you the access to the power and display mode. You can use this module to prevent the system from entering the low power mode. As we discussed, a classic example of this scenario is a video player. When the user clicks on the play button, you can ask this module to prevent low power mode, and you can stop monitoring the power state change when the user stops the playback. Here is an example for the powerSaveBlocker
module:
<html> <head> </head> <body> <script language="javascript"> const { powerSaveBlocker } = require('electron').remote; document.addEventListener("DOMContentLoaded", init, false...