2016-07-31 22:53:27 +00:00
|
|
|
/// <reference types="q" />
|
|
|
|
import * as plugins from "./taskbuffer.plugins";
|
2016-08-01 11:17:15 +00:00
|
|
|
export interface ITaskFunction {
|
|
|
|
(): PromiseLike<any>;
|
|
|
|
}
|
2016-05-04 02:28:50 +00:00
|
|
|
export declare class Task {
|
2016-05-14 02:28:22 +00:00
|
|
|
name: string;
|
2016-05-04 02:28:50 +00:00
|
|
|
task: any;
|
|
|
|
running: boolean;
|
2016-08-01 11:17:15 +00:00
|
|
|
runningBuffered: boolean;
|
2016-05-06 00:05:45 +00:00
|
|
|
idle: boolean;
|
2016-05-04 02:28:50 +00:00
|
|
|
buffered: boolean;
|
2016-05-04 03:20:51 +00:00
|
|
|
bufferCounter: number;
|
|
|
|
bufferMax: number;
|
2016-05-04 02:28:50 +00:00
|
|
|
private _counterTriggerAbsolute;
|
|
|
|
private _state;
|
|
|
|
preTask: Task;
|
|
|
|
afterTask: Task;
|
2016-05-05 16:36:31 +00:00
|
|
|
constructor(optionsArg: {
|
2016-08-01 11:17:15 +00:00
|
|
|
taskFunction: ITaskFunction;
|
2016-05-04 02:28:50 +00:00
|
|
|
preTask?: Task;
|
|
|
|
afterTask?: Task;
|
|
|
|
buffered?: boolean;
|
2016-05-05 17:21:50 +00:00
|
|
|
bufferMax?: number;
|
2016-05-14 21:24:11 +00:00
|
|
|
name?: string;
|
2016-05-04 02:28:50 +00:00
|
|
|
});
|
2016-08-01 11:17:15 +00:00
|
|
|
/**
|
|
|
|
* trigger the task. Will trigger buffered if this.buffered is true
|
|
|
|
*/
|
2016-07-31 22:53:27 +00:00
|
|
|
trigger(): plugins.Q.Promise<{}>;
|
2016-08-01 11:17:15 +00:00
|
|
|
/**
|
|
|
|
* trigger task unbuffered.
|
|
|
|
*/
|
2016-07-31 22:53:27 +00:00
|
|
|
triggerUnBuffered(): plugins.Q.Promise<{}>;
|
2016-08-01 11:17:15 +00:00
|
|
|
/**
|
|
|
|
* trigger task buffered.
|
|
|
|
*/
|
2016-07-31 22:53:27 +00:00
|
|
|
triggerBuffered(): plugins.Q.Promise<{}>;
|
2016-05-04 02:28:50 +00:00
|
|
|
state: string;
|
|
|
|
}
|