import { ApolloClientManager } from "../data/ApolloClientManager"; import { LocalStorageHandler } from "../helpers/LocalStorageHandler"; import { IJobs } from "./Jobs"; import { IQueuedJobs } from "./QueuedJobs"; import { JobFunctionParameters, QueuedJobFunctionParameters } from "./types"; export declare class JobsManager { private queue; private jobs; private localStorageHandler; private queuedJobs; constructor(localStorageHandler: LocalStorageHandler, apolloClientManager: ApolloClientManager); /** * Executes job immediately and returns result or error. * @param jobGroup Job group name referencing to the class with job functions. * @param jobName Jobs within group/class. * @param params Object passed as the first argument to the job function. */ run(jobGroup: G, jobName: J, params: JobFunctionParameters[0]): any; /** * Add job to the queue. If there is an internet connection available, job is executed immediatelly. * Otherwise job is inserted into the queue and delayed until internet connection will be restored. * Queue is persisted in local storage. * @param jobGroup Job group name referencing to the class with job functions. * @param jobName Jobs within group/class. */ addToQueue(jobGroup: G, jobName: J): void; /** * Attach event listener to the job group. * @param jobGroup Job group name referencing to the class with job functions. * @param onEventListener Function to be called if event will occur during job execution. */ attachEventListener(jobGroup: G, onEventListener: JobFunctionParameters[0]): void; /** * Attach error listener to the queued job group. * @param jobGroup Job group name referencing to the class with job functions. * @param onErrorListener Function to be called if error will occur during job execution. */ attachErrorListener(jobGroup: G, onErrorListener: QueuedJobFunctionParameters[0]): void; private runJob; private enqueueJob; private dequeueJob; private onOnline; private updateJobStateInRepository; private enqueueAllSavedInRepository; }