ocetnik / react-native-background-timer

Emit event periodically (even when app is in the background)
MIT License
1.6k stars 223 forks source link

[iOS] Clear timeout #158

Open cernadasjuan opened 4 years ago

cernadasjuan commented 4 years ago

Hi!

There is any way to clear a timeout in iOS? I saw that method is commented in iOS source code (RNBackgroundTimer.m)

/*
RCT_EXPORT_METHOD(clearTimeout:(int)timeoutId
                  resolver:(RCTPromiseResolveBlock)resolve
                  rejecter:(RCTPromiseRejectBlock)reject)
{
    // Do nothing :)
    // timeout will be ignored in javascript anyway :)
}*/

Thanks!!

yelkamel commented 4 years ago

On iOS, I used the primary fonction cleartimeout to clear this timeout:

BackgroundTimer.start(); timeroutID = setTimeout(() => { TrackPlayer.pause(); logInfo('BackgroundTimer=END'); }, duration); BackgroundTimer.stop();