-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
Current DispatcherPayloadMeta has dispatcher property.
export interface DispatcherPayloadMeta {
/**
* A reference to the useCase/dispatcher to which the payload was originally dispatched.
*/
readonly useCase: UseCaseLike | null;
/**
* A dispatcher of the payload
* In other word, the payload is dispatched by `this.dispatcher`
*
* ## Dispatcher in a useCase
*
* In following example, this.dispatcher is same with this.useCase.
*
* ```js
* class Example extends UseCase {
* execute(){
* this.dispatch({ type })
* // ^^^^
* // === this dispatcher === this.useCase
* }
* }
* ```
*/
readonly dispatcher: UseCase | Dispatcher | null;
/**
* A parent useCase of the `this.useCase`,
* When useCase is nesting, parentUseCase is a UseCase.
*/
readonly parentUseCase: UseCase | Dispatcher | null;
/**
* A timeStamp is created time of the meta.
*/
readonly timeStamp: number;
/**
* If the payload object is generated by Almin, true.
*
* The use can use it for detecting "Is the payload generated by system(almin)?".
* It is similar with https://www.w3.org/TR/DOM-Level-3-Events/#trusted-events
*/
readonly isTrusted: boolean;
/**
* If the useCase is finished, return true.
* Most of useCase is fixed value.
* But, DidExecutedPayload's value is case by case.
* In `DidExecutedPayload`, the value is false if the UseCase#execute return a promise.
* See https://github.com/almin/almin/issues/149
*/
readonly isUseCaseFinished: boolean;
/**
* If the payload object is dispatched in a transaction, to be transaction object
* otherwise, to be undefined
*/
transaction?: Transaction;
}I think that the dispatcher is no use case.
If you want to know that the payload is dispatched by a UseCase, you can use useCase property insead of disptcher.
We can remove the dispatcher from meta object.
Reactions are currently unavailable