You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-11Lines changed: 14 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,17 @@
4
4
<imgsrc="./assets/img.png"width="700"/>
5
5
</p>
6
6
7
-
**SyncTasksManager** is a native JSI-based library for React Native that allows you to manage and execute background sync tasks (such as periodic API polling) efficiently from JavaScript, while delegating the actual execution to the native layer for better performance.
7
+
**SyncTasksManager** is a native JSI-based library for React Native that allows you to manage and execute **native-threaded sync tasks** (such as periodic API polling) efficiently from JavaScript, while delegating the actual execution to the native layer for better performance.
8
+
9
+
> ⚠️ **Note**: This is not a background task manager — tasks do not continue running when the app is in the background or killed. The polling happens while the app is active, on a native thread, outside the JS thread.
8
10
9
11
---
10
12
11
13
## ⚙️ Features
12
14
13
15
- 🔁 Periodic HTTP polling with configurable interval
14
16
- 📡 Callback on data reception or error
15
-
- 🧵 High-performance task execution via JSI
17
+
- 🧵 High-performance execution via native thread using JSI
16
18
- 🧠 Centralized task management (start/stop all tasks)
17
19
- ✅ Seamless integration with native modules (C++/JSI)
18
20
- ✨ Built-in response deduplication using response body hash — avoids redundant `onData` calls if the response has not changed
|`onData`|`(data: { body: T, status_code: number }) => void`| Callback when data is successfully received |
88
-
|`onError`|`(error: { error: string; status_code: number }) => void`| Callback when request fails (optional) |
88
+
|`onData`|`(data: { body: T, status_code: number }) => void`| Callback when data is successfully received |
89
+
|`onError`|`(error: { error: string, status_code: number }) => void`| Callback when request fails (optional) |
89
90
90
91
> Under the hood, the task stores a hash of the last response body. If the newly fetched response is identical (hash matches), the `onData` callback will **not** be triggered.
91
92
92
93
### `Task`
93
94
94
-
Represents an individual background sync task.
95
+
Represents an individual polling task running on a native thread.
95
96
96
97
#### Methods:
97
98
@@ -103,7 +104,7 @@ Represents an individual background sync task.
103
104
104
105
### `SyncTasksManager`
105
106
106
-
A global task manager for controlling multiple tasks at once.
107
+
A global manager to control multiple polling tasks.
107
108
108
109
#### Methods:
109
110
@@ -120,3 +121,5 @@ MIT
120
121
121
122
---
122
123
124
+
🎉 **Enjoy using react-native-sync-tasks!** Offload polling to native threads and keep your JS thread free.
0 commit comments