react-native-background-timer
react-native-background-timer copied to clipboard
Improvement in Export Method as "export default BackgroundTimer()"
Hi,
Instead of using export as export default new BackgroundTimer()
in index.js, if it shall be done like export default BackgroundTimer()
, only one global instance of BackgroundTimer shall be created for the app.
Although there is no effect on memory usage(as per my knowledge) in both the way of exporting, one advantage shall be there in export default BackgroundTimer()
. The advantage is, as the BackgroundTimer instance is same in complete application, we can start a timer in one component and clear it in another component by passing the timeoutId/intervalId.
And if needed new BackgroundTimer()
can be used to create different instances.
Let me know, if I am wrong somewhere.