import { FileEntry } from './FileEntry'; import { Root } from './Root'; import { FileType } from './types'; import { ITreeSupervisor } from './types'; export declare class Directory extends FileEntry { static defaultSortComparator(a: FileEntry | Directory, b: FileEntry | Directory): 1 | 0 | -1; protected _children: Array; /** * Directory.children.length of self and all leafs (recursive) with isExpanded = true */ protected _branchSize: number; protected flattenedBranch: Uint32Array; private isExpanded; private watchTerminator; private hardReloadPromise; private hardReloadPResolver; protected constructor(root: Root, tree: ITreeSupervisor, parent: Directory, dirName: string, optionalMetadata?: { [key: string]: any; }); readonly type: FileType; readonly children: (FileEntry | Directory)[]; readonly expanded: boolean; /** * Number of *visible* flattened leaves this branch is incharge of (recursive) * * When a directory is expanded, its entire branch (recursively flattened) is owned by a branch higher up (either Root (at surface) or a branch in collapsed state (buried)) * * When a directory is collapsed, its entire branch (recursively flattened) is "returned" back to it by one of its parent higher up */ readonly branchSize: number; /** * Ensures the children of this `Directory` are loaded (without effecting the `expanded` state) * * If children are already loaded, returned `Promise` resolves immediately * * Otherwise a hard reload request is issued and returned `Promise` resolves when that process finishes. * * tl;dr: `Directory#children` are accessible once the returned `Promise` resolves */ ensureLoaded(): Promise; setExpanded(ensureVisible?: boolean): Promise; setCollapsed(): void; /** * Inserts the item into it's own parent (if not already) * * Gets called upon `IWatcherAddEvent` or `IWatcherMoveEvent` * * Calling this method directly WILL NOT trigger `onWillHandleWatchEvent` and `onDidHandleWatchEvent` events * * Prefer using `Root#inotify` instead */ insertItem(item: FileEntry | Directory): void; /** * Removes the item from parent * * Gets called upon `IWatcherRemoveEvent` or `IWatcherMoveEvent` * * Calling this method directly WILL NOT trigger `onWillHandleWatchEvent` and `onDidHandleWatchEvent` events * * Prefer using `Root#inotify` instead */ unlinkItem(item: FileEntry | Directory, reparenting?: boolean): void; mv(to: Directory, newName?: string): void; /** * WARNING: This will only stop watchers and clear bookkeeping records * To clean-up flattened branches and stuff, call Directory#removeItem in the parent * Directory#removeItem will call Directory#dispose anyway */ protected dispose(): void; /** * Using setter as Root needs to capture when the root flat tree is altered */ protected setFlattenedBranch(leaves: Uint32Array): void; protected expandBranch(branch: Directory): void; protected shrinkBranch(branch: Directory): void; protected hardReloadChildren(): Promise; private handleWatchEvent; private transferItem; }