rn-background-queue-processor-realm-adapter
v1.0.1
Published
Forked from @technogise/rn-background-queue-processor-realm-adapter to work with Realm v10.x. This package is designed for [rn-background-queue-processor](https://github.com/technogise/rn-background-queue-processor) to store Jobs in persistent Realm stora
Downloads
2
Maintainers
Readme
React Native Queue Processor Realm Adapter
This package is designed for rn-background-queue-processor to store Jobs in persistent Realm storage.
Compatibility
Our current version works well for Realm: v10.4.0
Usage
This packages is forked from @technogise. Here is a working demo app
- Two schema are there to store all jobs and Failed jobs
- Job Schema contains all the Jobs ready for execution
- Failed Schema have all the failed jobs after queue execution
- Jobs are sent for execution according to its priority
Functions that are used in rn-background-queue-processor are -
addItem(job)
: Method to add a job in JobSchemaaddFailedItem(job)
: Method to add a job in FailedJobSchemaremove(jobId)
: Method to remove jobgetLength()
: Method to get lengthgetTopItem
: Method to get high priority JobgetAllItems
: To get all jobsgetJobInstance
: Method to get job instanceaddFailedItems
: Method to add failed jobs in JobSchema
Installation steps
npm i rn-background-queue-processor-realm-adapter
Example import
import { RealmAdapter } from 'rn-background-queue-processor-realm-adapter';
constructor() {
const dbAdapter = new RealmAdapter(ExampleJob.prototype);
this.queue = new Queue(dbAdapter);
}