1 | /** @module run */
|
2 | import { Parameters } from './Parameters';
|
3 | /**
|
4 | * Interface for components that can be asynchronously notified.
|
5 | * The notification may include optional argument that describe
|
6 | * the occured event.
|
7 | *
|
8 | * @see [[Notifier]]
|
9 | * @see [[IExecutable]]
|
10 | *
|
11 | * ### Example ###
|
12 | *
|
13 | * class MyComponent implements INotifable {
|
14 | * ...
|
15 | * public notify(correlationId: string, args: Parameters): void {
|
16 | * console.log("Occured event " + args.getAsString("event"));
|
17 | * }
|
18 | * }
|
19 | *
|
20 | * let myComponent = new MyComponent();
|
21 | *
|
22 | * myComponent.notify("123", Parameters.fromTuples("event", "Test Event"));
|
23 | */
|
24 | export interface INotifiable {
|
25 | /**
|
26 | * Notifies the component about occured event.
|
27 | *
|
28 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
29 | * @param args notification arguments.
|
30 | */
|
31 | notify(correlationId: string, args: Parameters): void;
|
32 | }
|