UNPKG

react-async-states-utils

Version:
30 lines (27 loc) 996 B
import { isSource, requestContext } from 'async-states'; function run(keyOrSource, ...args) { return runImpl(keyOrSource, null, undefined, ...args); } function runLane(keyOrSource, lane, ...args) { return runImpl(keyOrSource, null, lane, ...args); } function runInContext(keyOrSource, context, ...args) { return runImpl(keyOrSource, context, undefined, ...args); } function runLaneInContext(keyOrSource, context, lane, ...args) { return runImpl(keyOrSource, context, lane, ...args); } function runImpl(keyOrSource, context, lane, ...args) { if (isSource(keyOrSource)) { return keyOrSource.getLane(lane).run(...args); } if (typeof keyOrSource === "string") { let instance = requestContext(context).get(keyOrSource); if (instance) { return instance.actions.run.apply(null, args); } } return undefined; } export { run, runInContext, runLane, runLaneInContext }; //# sourceMappingURL=run.js.map