Closed NicolaiVdS closed 6 months ago
small thing, but maybe we should have this instead
export function monitorFile(
path: string,
callback: (file: Gio.File, event: Gio.FileMonitorEvent) => void,
options?: { flags: Gio.FileMonitorFlags, recursive: boolean },
)
small thing, but maybe we should have this instead
export function monitorFile( path: string, callback: (file: Gio.File, event: Gio.FileMonitorEvent) => void, options?: { flags: Gio.FileMonitorFlags, recursive: boolean }, )
Ok i can see the point in using options but should flags still be used since
// FIXME: remove the checking in the next release
// @ts-expect-error
if (options?.flags === "file" || options?.flags === "directory") {
throw Error(
`${options?.flags}` +
" passed as a parameter in `monitorFile`. " +
"Specifying the type is no longer required."
);
}
that check was there because the third parameter used to be "file" | "directory"
, but it was removed with #302
this time, since it will be another breaking change, we need to update it to check if the third parameter is a number (Gio.FileMonitorFlags) and console.warn about it being changed to an options object
that check was there because the third parameter used to be
"file" | "directory"
, but it was removed with #302 this time, since it will be another breaking change, we need to update it to check if the third parameter is a number (Gio.FileMonitorFlags) and console.warn about it being changed to an options object
added the requested changes
added functionality to monitorFile to be recursive
NOTE: Recursive is true by default