npm.io
1.4.2 • Published 4 years ago

expo-job-queue

Licence
MIT
Version
1.4.2
Deps
2
Size
156 kB
Vulns
0
Weekly
0
Stars
15

expo-job-queue

An SQLite based job queue for Expo

Installation

yarn add expo-job-queue

Usage

import ExpoJobQueue from "expo-job-queue";

// ...

ExpoJobQueue.configure({
  onQueueFinish: () => {
    console.log("Queue stopped and executed")
  },
})

ExpoJobQueue.addWorker("testWorker", async (payload) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      console.log("JOB RAN: " + JSON.stringify(payload))
      resolve(undefined)
    }, payload.delay)
  })
})

// ...
ExpoJobQueue.addJob("testWorker", { text: "THIS IS FANTASTIC", delay: 1000 })

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Heavily copied from and inspired by react-native-job-queue licensed under the MIT License.

Keywords