/
DispatcherPayloadMeta.js
37 lines (37 loc) · 1.08 KB
/
DispatcherPayloadMeta.js
1
2
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
36
37
// LICENSE : MIT
"use strict";
/**
* DispatcherPayloadMeta is a meta object for dispatcher.
* This object is always created by System(= Almin).
* The user can get this meta object together with dispatched `payload` object
* @example
* context.onDispatch((payload, meta) => {});
*/
export default class DispatcherPayloadMeta {
/**
* @param {UseCase} [useCase]
* @param {UseCase|Dispatcher} [parentDispatcher]
*/
constructor({
useCase,
parentDispatcher
} = {}) {
/**
* @param {UseCase|Dispatcher|null|undefined} useCase A reference to the useCase/dispatcher to which the payload was originally dispatched.
* @public
*/
this.useCase = useCase;
/**
* Parent dispatcher/useCase of the `this.useCase`,
* @param {UseCase|Dispatcher|null|undefined}
* @public
*/
this.parentDispatcher = parentDispatcher;
/**
* timeStamp is created time of the meta.
* @type {number}
* @public
*/
this.timeStamp = Date.now();
}
}