summaryrefslogtreecommitdiffhomepage
path: root/src/features/markdown/types.ts
blob: cb3fe8d64d14ce0f514fa83e5bb2af180f0b0720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import type { TextFileContextResponse, TextFileResponse } from "@dispatch/transport-contract";

export type TextFileState =
  | { readonly kind: "loading" }
  | { readonly kind: "error"; readonly message: string }
  | { readonly kind: "ready"; readonly file: TextFileResponse };
export interface TextFileClient {
  subscribe(path: string, listener: (state: TextFileState) => void): () => void;
  /** Refresh context as well as the live on-disk file. */
  refresh(path: string): void;
  dispose(): void;
}
export type TextFileContext = TextFileContextResponse;