Skip to content

Latest commit

 

History

History
30 lines (27 loc) · 698 Bytes

File metadata and controls

30 lines (27 loc) · 698 Bytes

React Native Background Timer

Emit event periodically (also when application is running in the background).

Currently for Android only.

Instalation

  • npm install react-native-background-timer --save
  • rnpm link

Usage

var {DeviceEventEmitter} = React;
var BackgroundTimer = require('react-native-background-timer');
// start timing
BackgroundTimer.start(5000); // delay in milliseconds
// listen for event
DeviceEventEmitter.addListener('backgroundTimer', () => {
	// this will be executed every 5 seconds
	// also when application is running in the background
	console.log('tic');
});
// you can explicitly stop timing
BackgroundTimer.stop();