ink
Version:
React for CLI
36 lines (30 loc) • 989 B
TypeScript
export type Props = {
/**
Exit (unmount) the whole Ink app.
- `exit()` — resolves `waitUntilExit()` with `undefined`.
- `exit(new Error('…'))` — rejects `waitUntilExit()` with the error.
- `exit(value)` — resolves `waitUntilExit()` with `value`.
*/
readonly exit: (errorOrResult?: Error | unknown) => void;
/**
Returns a promise that settles after pending render output is flushed to stdout.
@example
```jsx
import {useEffect} from 'react';
import {useApp} from 'ink';
const Example = () => {
const {waitUntilRenderFlush} = useApp();
useEffect(() => {
void (async () => {
await waitUntilRenderFlush();
runNextCommand();
})();
}, [waitUntilRenderFlush]);
return …;
};
```
*/
readonly waitUntilRenderFlush: () => Promise<void>;
};
declare const AppContext: import("react").Context<Props>;
export default AppContext;