react-native-workers
react-native-workers copied to clipboard
Up to next / Notes
- [x] Start a single worker on Android and iOS.
- [x] Create bridge between app code and worker code using string messages.
- [x] Make worker functional with chrome debugger.
- [x] Update native api for more flexibility in the worker creation.
- [x] Create more than one worker.
- [x] Update/wrap js api to follow webworker api.
- [x] Disable workers and simulate running code on app process
- [ ] Turn worker off and run tasks on app looper/worker.
- [ ] Start worker for background tasks.
- [ ] Create and terminate workers in runtime on production.
Trying to a generic solution to work with any iOS background modes but mostly Finite tasks.
For Android, maybe a Alarm manager with 10 minutes timeout. With doze enabled, network will be unavailable. In this case, notification push can do the magic. (thanks @josericardooliveira)
Note:
Wake up or reuse a worker when notification is receive and send through onnotification listener. Behavior will be the same for iOS and Android even in doze mode.
May cause problems with chrome debugger, have to check
const worker = new WorkerService() worker.onmessage = message => {} worker.onnotificaion = message => {}