about summary refs log tree commit diff
path: root/src/state/lib/bg-scheduler.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-01-26 12:36:27 -0600
committerPaul Frazee <pfrazee@gmail.com>2023-01-26 12:36:27 -0600
commit751dfb20fd0d316da396e3c4fc53aaaaa8041dd1 (patch)
tree55c23e901903cfa19b6b9acc264df0d0637d66f0 /src/state/lib/bg-scheduler.ts
parentd6ec627c8cd32836e5ed494606318959ca17fca1 (diff)
downloadvoidsky-751dfb20fd0d316da396e3c4fc53aaaaa8041dd1.tar.zst
Add web polyfills
Diffstat (limited to 'src/state/lib/bg-scheduler.ts')
-rw-r--r--src/state/lib/bg-scheduler.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/state/lib/bg-scheduler.ts b/src/state/lib/bg-scheduler.ts
new file mode 100644
index 000000000..97ccb78b2
--- /dev/null
+++ b/src/state/lib/bg-scheduler.ts
@@ -0,0 +1,18 @@
+import BackgroundFetch, {
+  BackgroundFetchStatus,
+} from 'react-native-background-fetch'
+
+export function configure(
+  handler: (taskId: string) => Promise<void>,
+  timeoutHandler: (taskId: string) => Promise<void>,
+): Promise<BackgroundFetchStatus> {
+  return BackgroundFetch.configure(
+    {minimumFetchInterval: 15},
+    handler,
+    timeoutHandler,
+  )
+}
+
+export function finish(taskId: string) {
+  return BackgroundFetch.finish(taskId)
+}