AppContext.ts
ink/components/AppContext.ts
22
Lines
523
Bytes
1
Exports
1
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with repo-context, ui-flow. It contains 22 lines, 1 detected imports, and 1 detected exports.
Important relationships
Detected exports
Props
Keywords
exitappcontextcreatecontextreactunmounteslint-disable-next-linewholereadonlyvoidcontext
Detected imports
react
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import { createContext } from 'react'
export type Props = {
/**
* Exit (unmount) the whole Ink app.
*/
readonly exit: (error?: Error) => void
}
/**
* `AppContext` is a React context, which exposes a method to manually exit the app (unmount).
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
const AppContext = createContext<Props>({
exit() {},
})
// eslint-disable-next-line custom-rules/no-top-level-side-effects
AppContext.displayName = 'InternalAppContext'
export default AppContext