1 | /** @module run */
|
2 | /**
|
3 | * Interface for components that should clean their state.
|
4 | *
|
5 | * Cleaning state most often is used during testing.
|
6 | * But there may be situations when it can be done in production.
|
7 | *
|
8 | * @see [[Cleaner]]
|
9 | *
|
10 | * ### Example ###
|
11 | *
|
12 | * class MyObjectWithState implements ICleanable {
|
13 | * private _state: any = {};
|
14 | * ...
|
15 | * public clear(correlationId: string): void {
|
16 | * this._state = {};
|
17 | * }
|
18 | * }
|
19 | *
|
20 | */
|
21 | export interface ICleanable {
|
22 | /**
|
23 | * Clears component state.
|
24 | *
|
25 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
26 | * @param callback callback function that receives error or null no errors occured.
|
27 | */
|
28 | clear(correlationId: string, callback?: (err: any) => void): void;
|
29 | }
|