Skip to content

Commit d2c24dc

Browse files
author
Matthew Daronco
authored
Increase timeout Parameter to Accept 64-bit Integers for Larger Timeouts (ocetnik#239)
* timeout should be a double to support larger values * cast double to long * update ios code to use double for timeout * increment version to 2.3.0
1 parent 13b19a5 commit d2c24dc

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

android/src/main/java/com/ocetnik/timer/BackgroundTimerModule.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void sendEvent(ReactContext reactContext, String eventName) {
7575
}
7676

7777
@ReactMethod
78-
public void setTimeout(final int id, final int timeout) {
78+
public void setTimeout(final int id, final double timeout) {
7979
Handler handler = new Handler();
8080
handler.postDelayed(new Runnable(){
8181
@Override
@@ -86,7 +86,7 @@ public void run(){
8686
.emit("backgroundTimer.timeout", id);
8787
}
8888
}
89-
}, timeout);
89+
}, (long) timeout);
9090
}
9191

9292
/*@ReactMethod

ios/RNBackgroundTimer.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (void) _stop
4444
}
4545
}
4646

47-
RCT_EXPORT_METHOD(start:(int)_delay
47+
RCT_EXPORT_METHOD(start:(double)_delay
4848
resolver:(RCTPromiseResolveBlock)resolve
4949
rejecter:(RCTPromiseRejectBlock)reject)
5050
{
@@ -61,7 +61,7 @@ - (void) _stop
6161
}
6262

6363
RCT_EXPORT_METHOD(setTimeout:(int)timeoutId
64-
timeout:(int)timeout
64+
timeout:(double)timeout
6565
resolver:(RCTPromiseResolveBlock)resolve
6666
rejecter:(RCTPromiseRejectBlock)reject)
6767
{

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-background-timer",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "Emit event periodically (even when app is in the background)",
55
"keywords": [
66
"react-native",

0 commit comments

Comments
 (0)