summaryrefslogtreecommitdiff
path: root/runtime/js/40_fs_events.js
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2023-11-01 20:26:12 +0100
committerGitHub <noreply@github.com>2023-11-01 20:26:12 +0100
commitd42f1543121e7245789a96a485d1ef7645cb5fba (patch)
treed57a10ac527fe5b6796a3a8866af95f0f1a5d7bd /runtime/js/40_fs_events.js
parent1d19b1011bd7df50598f5981408c2d78c35b76d2 (diff)
feat: disposable Deno resources (#20845)
This commit implements Symbol.dispose and Symbol.asyncDispose for the relevant resources. Closes #20839 --------- Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime/js/40_fs_events.js')
-rw-r--r--runtime/js/40_fs_events.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/js/40_fs_events.js b/runtime/js/40_fs_events.js
index 4c2f5fc9a..b10f6fd10 100644
--- a/runtime/js/40_fs_events.js
+++ b/runtime/js/40_fs_events.js
@@ -9,6 +9,8 @@ const {
PromiseResolve,
SymbolAsyncIterator,
} = primordials;
+import { SymbolDispose } from "ext:deno_web/00_infra.js";
+
class FsWatcher {
#rid = 0;
@@ -51,6 +53,10 @@ class FsWatcher {
[SymbolAsyncIterator]() {
return this;
}
+
+ [SymbolDispose]() {
+ core.tryClose(this.#rid);
+ }
}
function watchFs(