Interface: NVECommitDirent()
A function signature for commit/save hooks on a NVEDirent.
Implementers can provide a custom commit handler to persist changes to a file, e.g. saving to a backend, local storage, or other destination. The function receives the dirent instance and should return a boolean (or Promised boolean) indicating success.
Example
ts
const onCommit: NVECommitDirent = async (dirent) => {
await saveToServer(dirent.path, dirent.content);
return true;
};
const file = new NVEDirent({ name: "foo.txt", parentPath: "/", onCommit });
await file.commit();ts
NVECommitDirent(dirent: NVEDirent): boolean | Promise<boolean>;Parameters
| Parameter | Type | Description |
|---|---|---|
dirent | NVEDirent | The NVEDirent instance being committed. |
Returns
boolean | Promise<boolean>
A boolean or Promised boolean indicating whether the commit was successful.