roldanjr / use-stay-awake Goto Github PK
View Code? Open in Web Editor NEWReact hook that make device stay awake while actively using your website.
Home Page: https://roldanjr.github.io/use-stay-awake/
License: MIT License
React hook that make device stay awake while actively using your website.
Home Page: https://roldanjr.github.io/use-stay-awake/
License: MIT License
environments
Hi all,
I'm working on a React application that requires to stay awake permanently, at least for now, and its working well on most Android browsers, but I noticed that it has issues on Safari >14.0
(iOS devices) and Firefox for Android 85.1.3
(Android devices).
Working versions:
Not working versions:
I know that the Browser Supports section from the README specifies that the library works from v3.2
to v14.0
, but I wonder if there is any chance to add support to the latest versions of Safari. I don't have an iPhone or iPad myself to debug the issue and submit a pull request, I had to ask a friend of mine to check if it worked on his devices.
EDIT: I downloaded Firefox for Android and it's not working on v85 (which makes sense considering that you only support to v68), so I added it to the list of not working versions.
Error caught on Firefox console through USB Debugging
EDIT 2: I noticed that I didn't upload the code example I'm using. This would be helpful for you guys, because I'm not using the preventSleeping()
method inside an event, such as a click.
const WakeLock = () => {
const { preventSleeping } = useStayAwake();
useEffect(() => {
preventSleeping();
}, [preventSleeping]);
return <Fragment />;
};
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.