Usage
Signature
Result
| Property | Type | Description |
|---|---|---|
| status | UseWatchTextFileStatus | The file watcher’s status. Useful for ensuring the desired file is being watched. |
| content | string | null | If watching, the contents of the file located at the provided filePath |
| watchError | string | null | If an error occurs, the corresponding error message |
| writeChange | WriteChange | null | If watching, a function to update the watched file |
Types
TextChange
| Property | Type |
|---|---|
| from | number |
| to? | number |
| insert? | string |
UseWatchTextFileErrorLike
| Property | Type |
|---|---|
| status | UseWatchTextFileStatus.Error | UseWatchTextFileStatus.Moved | UseWatchTextFileStatus.Deleted |
| content | null |
| watchError | string | null |
| writeChange | null |
UseWatchTextFileLoading
| Property | Type |
|---|---|
| status | UseWatchTextFileStatus.Loading |
| content | null |
| watchError | null |
| writeChange | null |
UseWatchTextFileWatching
| Property | Type |
|---|---|
| status | UseWatchTextFileStatus.Watching |
| content | string |
| watchError | null |
| writeChange | WriteChange |