Skip to content

utils

import {
  getActionStatus
} from "exome/utils";

function getActionStatus

Subscribes to specific action in specific instance and returns satus about that action.

function getActionStatus<E = Error, T extends Exome = any>(
  store: T,
  action: keyof T,
): ActionStatus<E>;
interface ActionStatus<E = any> {
  loading: boolean;
  error: false | E;
  unsubscribe: () => void;
}
Example
class Store extends Exome {
  public get satus() {
    return getActionStatus(this, "fetchRemoteData")
  }
 
  public async fetchRemoteData() {}
}