Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
screen-wake-lock
Advanced tools
Readme
React library to prevent device from entering sleep mode when app is in active tab.
# Install using npm
npm install screen-wake-lock
# Install using yarn
yarn add screen-wake-lock
import React from 'react';
import ReactDOM from 'react-dom';
import ScreenWakeLock from 'screen-wake-lock';
import App from './App';
ReactDOM.render(
<React.StrictMode>
<ScreenWakeLock />
<App />
</React.StrictMode>,
document.getElementById('root'),
);
import React from 'react';
import ScreenWakeLock from 'screen-wake-lock';
const SpecificComponent = () => {
return (
<>
<ScreenWakeLock />
<div>Sleepless in Seattle</div>
</>
);
};
export default SpecificComponent;
import React from 'react';
import { useScreenWakeLock } from 'screen-wake-lock';
const SpecificComponent = () => {
useScreenWakeLock();
return <div>Sleepless in Seattle</div>;
};
export default SpecificComponent;
useScreenWakeLock
takes an optional parameter debug
. When passed true
it will print the status of the wake lock to the console whenever it gets locked or released. for instance when navigating away from the browser tab where the app is running and back. This can be a convenient way to test that the hook is working.
import React from 'react';
import { useScreenWakeLock } from 'screen-wake-lock';
const SpecificComponent = () => {
useScreenWakeLock(true);
return <div>Sleepless in Seattle</div>;
};
export default SpecificComponent;
// Screen Wake Lock released: true
// Screen Wake Lock released: false
Check that linting, formatting, build and tests pass
npm run lint
npm run format
npm run build
npm test
Bump version
npm version [major | minor | patch]
Publish to NPM
npm publish
FAQs
React library to prevent computer from entering sleep mode
The npm package screen-wake-lock receives a total of 9 weekly downloads. As such, screen-wake-lock popularity was classified as not popular.
We found that screen-wake-lock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.