react-native-background-task
Version:
Periodic background tasks for React Native apps, cross-platform (iOS and Android), which run even when the app is closed.
26 lines (23 loc) • 508 B
JavaScript
// @flow
/**
* See README.md for documentation
*/
export type ScheduleOptions = {
period?: number,
timeout?: number,
flex?: number,
}
export type StatusResponse = {
available: boolean,
unavailableReason?: 'denied' | 'restricted',
}
/**
* See README.md for documentation
*/
export type BackgroundTaskInterface = {
define: (task: () => void) => void,
schedule: (options?: ScheduleOptions) => void,
finish: () => void,
cancel: () => void,
statusAsync: () => Promise<StatusResponse>,
}