Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added recursive option to monitorFile #345

Merged
merged 2 commits into from
Mar 19, 2024
Merged

added recursive option to monitorFile #345

merged 2 commits into from
Mar 19, 2024

Conversation

NicolaiVdS
Copy link
Contributor

added functionality to monitorFile to be recursive

NOTE: Recursive is true by default

@Aylur
Copy link
Owner

Aylur commented Mar 17, 2024

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 },
)

@NicolaiVdS
Copy link
Contributor Author

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."
    );
  }

@Aylur
Copy link
Owner

Aylur commented Mar 18, 2024

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

@NicolaiVdS
Copy link
Contributor Author

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

@Aylur Aylur merged commit 9e05a96 into Aylur:main Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants