summaryrefslogtreecommitdiff
path: root/runtime/js/40_fs_events.js
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-01-25 04:57:28 +1100
committerGitHub <noreply@github.com>2024-01-24 18:57:28 +0100
commit547468e625a7b040690a6f26901597b5672ac413 (patch)
tree4c6fbfe7f2897130a65b93c9c9ae350d8cd3c951 /runtime/js/40_fs_events.js
parent48c19d0bab5c1977e0d61a83d8e13c2bc26ef398 (diff)
feat: deprecate `Deno.FsWatcher.rid` (#22074)
For removal in Deno v2. I've also updated the deprecation of `Deno.FsWatcher.return()`, which, to be clear, I'm not in favour of deprecating. I mention this in #15499. Either way, it's safe to merge this PR, then decide against the deprecation.
Diffstat (limited to 'runtime/js/40_fs_events.js')
-rw-r--r--runtime/js/40_fs_events.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/runtime/js/40_fs_events.js b/runtime/js/40_fs_events.js
index 0bc614335..4c7050b9f 100644
--- a/runtime/js/40_fs_events.js
+++ b/runtime/js/40_fs_events.js
@@ -27,12 +27,17 @@ class FsWatcher {
}
get rid() {
+ internals.warnOnDeprecatedApi(
+ "Deno.FsWatcher.rid",
+ new Error().stack,
+ "Use `Deno.FsWatcher` instance methods instead.",
+ );
return this.#rid;
}
async next() {
try {
- const value = await op_fs_events_poll(this.rid);
+ const value = await op_fs_events_poll(this.#rid);
return value ? { value, done: false } : { value: undefined, done: true };
} catch (error) {
if (ObjectPrototypeIsPrototypeOf(BadResourcePrototype, error)) {
@@ -49,11 +54,8 @@ class FsWatcher {
// TODO(kt3k): This is deprecated. Will be removed in v2.0.
// See https://github.com/denoland/deno/issues/10577 for details
return(value) {
- internals.warnOnDeprecatedApi(
- "Deno.FsWatcher.return()",
- new Error().stack,
- );
- core.close(this.rid);
+ internals.warnOnDeprecatedApi("Deno.FsWatcher.return()", new Error().stack);
+ core.close(this.#rid);
return PromiseResolve({ value, done: true });
}