This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
2020-11-27 17:48:10 +00:00
|
|
|
/* eslint-disable flowtype/require-valid-file-annotation */
|
2020-11-27 05:11:35 +00:00
|
|
|
export default class Queue {
|
2020-11-27 17:48:10 +00:00
|
|
|
name;
|
2020-11-27 05:11:35 +00:00
|
|
|
|
|
|
|
constructor(name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
process = (fn) => {
|
|
|
|
console.log(`Registered function ${this.name}`);
|
|
|
|
this.processFn = fn;
|
|
|
|
};
|
|
|
|
|
|
|
|
add = (data) => {
|
|
|
|
console.log(`Running ${this.name}`);
|
|
|
|
return this.processFn({ data });
|
|
|
|
};
|
|
|
|
}
|