summaryrefslogtreecommitdiffhomepage
path: root/src/features/markdown/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/markdown/types.ts')
-rw-r--r--src/features/markdown/types.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/features/markdown/types.ts b/src/features/markdown/types.ts
new file mode 100644
index 0000000..cb3fe8d
--- /dev/null
+++ b/src/features/markdown/types.ts
@@ -0,0 +1,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;