Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Dispatcher): Introduce DispatcherPayloadMeta
- Add DispatcherPayloadMeta.js - Dispatcher User dispatch `payload` and `meta`. refs #61
- Loading branch information
Showing
15 changed files
with
223 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.