Almin

Almin

  • Docs
  • API
  • Blog
  • Help
  • GitHub

›API

Introduction

  • Getting Started
  • Components of Almin
  • Principles
  • Hello World

Tutorial

  • Example projects
  • Counter Tutorial
  • Todo App tutorial

Guides

  • Logging
  • Nesting UseCase
  • Performance profile
  • Strict mode
  • UseCase LifeCycle
  • TypeScript

Troubleshooting

  • UseCase is already released

Appendix

  • GLOSSARY

API

  • API Index
  • Context
  • Dispatcher
  • DispatcherPayloadMeta
  • LifeCycleEventHub
  • Store
  • StoreGroup
  • UseCase
  • UseCaseContext
  • UseCaseExecutor
Edit

DispatcherPayloadMeta

Interface

export interface Transaction {
    readonly id: string;
    readonly name: string;
}
export interface DispatcherPayloadMeta {
    readonly useCase: UseCaseLike | null;
    readonly parentUseCase: UseCase | Dispatcher | null;
    readonly timeStamp: number;
    readonly isTrusted: boolean;
    readonly isUseCaseFinished: boolean;
    transaction?: Transaction;
}

Interface

export interface Transaction {
    readonly id: string;
    readonly name: string;

Transaction data structure


export interface DispatcherPayloadMeta {

DispatcherPayloadMeta is a meta object for payload.

When Dispatcher dispatch payload with DispatcherPayloadMeta instance object.

const dispatcher = new Dispatcher();
dispatcher.onDispatch((payload, meta) => {
   console.log(meta); // instance of DispatcherPayloadMeta
   console.log(meta.useCase); // reference to UseCase
   console.log(meta.parentUseCase); // reference to Parent UseCase
   console.log(meta.timeStamp); // Timestamp
   console.log(meta.isTrusted); // Is it system payload?
});

readonly useCase: UseCaseLike | null;

A reference to the useCase/dispatcher to which the payload was originally dispatched.


readonly parentUseCase: UseCase | Dispatcher | null;

A parent useCase of the this.useCase, When useCase is nesting, parentUseCase is a UseCase.


readonly timeStamp: number;

A timeStamp is created time of the meta.


readonly isTrusted: boolean;

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 isUseCaseFinished: 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


transaction?: Transaction;

If the payload object is dispatched in a transaction, to be transaction object otherwise, to be undefined


← DispatcherLifeCycleEventHub →
Almin
Docs
Getting StartedTutorialAPI Reference
Community
User ShowcaseStack OverflowTwitter
GitHub
GitHubReleasesIssuesStar
Copyright © 2021 azu