react-native-set-timer
v1.0.2
Published
setInterval and setTimeout that work even if the app is running in the background
Downloads
18
Maintainers
Readme
react-native-set-timer
This library provides setTimeout
and setInterval
implementations that keep working even if the app is running in the background or the screen is locked.
Features
- Clear and simple API
Install
yarn add react-native-set-timer
Usage
import Timer from "react-native-set-timer";
// Start a timer
const intervalId = Timer.setInterval(() => console.log(""), 500);
// Cancel the timer
Timer.clearInterval(intervalId);
// Start a timer t
const timeoutId = Timer.setTimeout(() => console.log("tic"), 500);
// Cancel the timer
Timer.clearTimeout(timeoutId);