Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/navigation/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export type ContentsWithRoot = {
contents: Node[]
}

interface CancellablePromise<T> extends Promise<T> {
cancel?: (reason?: unknown) => void
}

interface ViewData {
/** Unique view ID */
id: string
Expand All @@ -50,8 +54,10 @@ interface ViewData {
* change and the promise is not resolved yet.
* You _must_ also return the current directory
* information alongside with its content.
* @param path The current path in the view
* @param onUpdate Optional callback to inform if the content changed since the last call
*/
getContents: (path: string) => Promise<ContentsWithRoot>
getContents: (path: string, onUpdate?: () => void) => CancellablePromise<ContentsWithRoot>
/** The view icon as an inline svg */
icon: string
/** The view order */
Expand Down