Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
836 changes: 432 additions & 404 deletions lib/commonjs/Queue.js

Large diffs are not rendered by default.

179 changes: 178 additions & 1 deletion lib/commonjs/Queue.js.map

Large diffs are not rendered by default.

810 changes: 418 additions & 392 deletions lib/module/Queue.js

Large diffs are not rendered by default.

151 changes: 150 additions & 1 deletion lib/module/Queue.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions lib/typescript/src/Queue.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Job, RawJob } from './models/Job';
import { Worker } from './Worker';
import EventEmitter from 'eventemitter3';
type QueueErrorType = "cancelled" | "error";
export declare class QueueError extends Error {
code: QueueErrorType;
constructor(message: string, code?: QueueErrorType);
}
export interface QueueEvents {
workerAdded: (workerName: string) => void;
jobAdded: (job: RawJob) => void;
Expand Down
2 changes: 1 addition & 1 deletion lib/typescript/src/Queue.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-job-queue",
"title": "React Native Job Queue",
"version": "0.5.17",
"version": "0.5.18",
"description": "A job queue for React Native",
"react-native": "src/index.ts",
"types": "lib/typescript/src",
Expand Down
4 changes: 2 additions & 2 deletions src/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export class Queue extends EventEmitter<QueueEvents> {
const isRunning = this.runningJobPromises[job.id];
// eslint-disable-next-line @typescript-eslint/no-misused-promises
if (!!Boolean(isRunning)) {
this.cancelJob(job.id, new Error(`Job with id ${job.id} cancelled`));
this.cancelJob(job.id, new QueueError(`Job with id ${job.id} cancelled`, "cancelled"));
}
this.jobStore.updateJob(newJob as RawJob);
this.emit('jobCancelled', newJob as RawJob);
Expand All @@ -329,7 +329,7 @@ export class Queue extends EventEmitter<QueueEvents> {
const isRunning = this.runningJobPromises[job.id];
// eslint-disable-next-line @typescript-eslint/no-misused-promises
if (!!isRunning) {
this.cancelJob(job.id, new Error(`Job with id ${job.id} cancelled`));
this.cancelJob(job.id, new QueueError(`Job with id ${job.id} cancelled`, "cancelled"));
}

this.jobStore.updateJob(newJob as RawJob);
Expand Down