1 | import { IClosable } from './IClosable';
|
2 | import { INotifiable } from './INotifiable';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export declare class FixedRateTimer implements IClosable {
|
36 | private _task;
|
37 | private _callback;
|
38 | private _delay;
|
39 | private _interval;
|
40 | private _timer;
|
41 | private _timeout;
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | constructor(taskOrCallback?: any, interval?: number, delay?: number);
|
55 | /**
|
56 | * Gets the INotifiable object that receives notifications from this timer.
|
57 | *
|
58 | * @returns the INotifiable object or null if it is not set.
|
59 | */
|
60 | getTask(): INotifiable;
|
61 | /**
|
62 | * Sets a new INotifiable object to receive notifications from this timer.
|
63 | *
|
64 | * @param value a INotifiable object to be triggered.
|
65 | */
|
66 | setTask(value: INotifiable): void;
|
67 | /**
|
68 | * Gets the callback function that is called when this timer is triggered.
|
69 | *
|
70 | * @returns the callback function or null if it is not set.
|
71 | */
|
72 | getCallback(): () => void;
|
73 | /**
|
74 | * Sets the callback function that is called when this timer is triggered.
|
75 | *
|
76 | * @param value the callback function to be called.
|
77 | */
|
78 | setCallback(value: () => void): void;
|
79 | /**
|
80 | * Gets initial delay before the timer is triggered for the first time.
|
81 | *
|
82 | * @returns the delay in milliseconds.
|
83 | */
|
84 | getDelay(): number;
|
85 | /**
|
86 | * Sets initial delay before the timer is triggered for the first time.
|
87 | *
|
88 | * @param value a delay in milliseconds.
|
89 | */
|
90 | setDelay(value: number): void;
|
91 | /**
|
92 | * Gets periodic timer triggering interval.
|
93 | *
|
94 | * @returns the interval in milliseconds
|
95 | */
|
96 | getInterval(): number;
|
97 | /**
|
98 | * Sets periodic timer triggering interval.
|
99 | *
|
100 | * @param value an interval in milliseconds.
|
101 | */
|
102 | setInterval(value: number): void;
|
103 | /**
|
104 | * Checks if the timer is started.
|
105 | *
|
106 | * @returns true if the timer is started and false if it is stopped.
|
107 | */
|
108 | isStarted(): boolean;
|
109 | /**
|
110 | * Starts the timer.
|
111 | *
|
112 | * Initially the timer is triggered after delay.
|
113 | * After that it is triggered after interval until it is stopped.
|
114 | *
|
115 | * @see [[stop]]
|
116 | */
|
117 | start(): void;
|
118 | /**
|
119 | * Stops the timer.
|
120 | *
|
121 | * @see [[start]]
|
122 | */
|
123 | stop(): void;
|
124 | /**
|
125 | * Closes the timer.
|
126 | *
|
127 | * This is required by [[ICloseable]] interface,
|
128 | * but besides that it is identical to stop().
|
129 | *
|
130 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
131 | * @param callback callback function that receives error or null no errors occured.
|
132 | *
|
133 | * @see [[stop]]
|
134 | */
|
135 | close(correlationId: string, callback?: (err: any) => void): void;
|
136 | }
|