UNPKG

@shopify/cli-kit

Version:

A set of utilities, interfaces, and models that are common across all the platform features

17 lines 531 B
import { useApp } from 'ink'; import { useEffect } from 'react'; export default function useAsyncAndUnmount(asyncFunction, { onFulfilled = () => { }, onRejected = () => { } } = {}) { const { exit: unmountInk } = useApp(); useEffect(() => { asyncFunction() .then(() => { onFulfilled(); unmountInk(); }) .catch((error) => { onRejected(error); unmountInk(error); }); }, []); } //# sourceMappingURL=use-async-and-unmount.js.map