core-native
Version:
A lightweight framework based on React Native + Redux + Redux Saga, in strict TypeScript.
18 lines • 563 B
JavaScript
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 = "global") {
return createActionHandlerDecorator(function* (handler) {
try {
yield put(loadingAction(true, identifier));
yield* handler();
}
finally {
yield put(loadingAction(false, identifier));
}
});
}
//# sourceMappingURL=Loading.js.map