![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-native-background-timer
Advanced tools
Emit event periodically (even when app is in the background)
Emit event periodically (even when app is in the background).
npm i react-native-background-timer --save
react-native link
npm i react-native-background-timer --save
pod 'react-native-background-timer', :path => '../node_modules/react-native-background-timer'
You can use the setInterval
and setTimeout
functions.
This API is identical to that of react-native
and can be used to quickly replace existing timers
with background timers.
import BackgroundTimer from 'react-native-background-timer';
// Start a timer that runs continuous after X milliseconds
const intervalId = BackgroundTimer.setInterval(() => {
// this will be executed every 200 ms
// even when app is the the background
console.log('tic');
}, 200);
// Cancel the timer when you are done with it
BackgroundTimer.clearInterval(intervalId);
// Start a timer that runs once after X milliseconds
const timeoutId = BackgroundTimer.setTimeout(() => {
// this will be executed once after 10 seconds
// even when app is the the background
console.log('tac');
}, 10000);
// Cancel the timeout if necessary
BackgroundTimer.clearTimeout(timeoutId);
Obsolete usage which doesn't allows to use multiple background timers.
import {
DeviceEventEmitter,
NativeAppEventEmitter,
Platform,
} from 'react-native';
import BackgroundTimer from 'react-native-background-timer';
const EventEmitter = Platform.select({
ios: () => NativeAppEventEmitter,
android: () => DeviceEventEmitter,
})();
// start a global timer
BackgroundTimer.start(5000); // delay in milliseconds
// listen for event
EventEmitter.addListener('backgroundTimer', () => {
// this will be executed every 5 seconds
// even when app is the the background
console.log('toe');
});
// stop the timer
BackgroundTimer.stop();
FAQs
Emit event periodically (even when app is in the background)
The npm package react-native-background-timer receives a total of 39,899 weekly downloads. As such, react-native-background-timer popularity was classified as popular.
We found that react-native-background-timer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.