UNPKG

core-native

Version:

A lightweight framework based on React Native + Redux + Redux Saga, in strict TypeScript.

18 lines (16 loc) 523 B
import {createActionHandlerDecorator} from "./index"; import {put} from "redux-saga/effects"; import {loadingAction} from "../reducer"; /** * To mark state.loading[identifier] during action execution. */ export function Loading(identifier: string = "global") { return createActionHandlerDecorator(function* (handler) { try { yield put(loadingAction(true, identifier)); yield* handler(); } finally { yield put(loadingAction(false, identifier)); } }); }