Coder Social home page Coder Social logo

roldanjr / use-stay-awake Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 4.0 2.32 MB

React hook that make device stay awake while actively using your website.

Home Page: https://roldanjr.github.io/use-stay-awake/

License: MIT License

TypeScript 75.35% JavaScript 24.65%

use-stay-awake's People

Contributors

akumuliation avatar roldanjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

use-stay-awake's Issues

Library not working on latest iOS Safari versions

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:

  • Chrome for Android (v88.0.4324.181)
  • Edge for Android (v46.01.4.5140)
  • Mi Browser for Android (v12.8.3-gn)

Not working versions:

  • iOS Safari (v14.3 & v14.4) โ€” it was tested on both versions
  • Firefox for Android (v85.1.3)

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
image

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.