summaryrefslogtreecommitdiff
path: root/ext/web
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 /ext/web
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 'ext/web')
-rw-r--r--ext/web/00_infra.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/web/00_infra.js b/ext/web/00_infra.js
index e9d5dd48b..441081604 100644
--- a/ext/web/00_infra.js
+++ b/ext/web/00_infra.js
@@ -32,6 +32,7 @@ const {
StringPrototypeSubstring,
StringPrototypeToLowerCase,
StringPrototypeToUpperCase,
+ Symbol,
TypeError,
} = primordials;
import { URLPrototype } from "ext:deno_url/00_url.js";
@@ -458,6 +459,12 @@ function pathFromURL(pathOrUrl) {
// it in unit tests
internals.pathFromURL = pathFromURL;
+// deno-lint-ignore prefer-primordials
+export const SymbolDispose = Symbol.dispose ?? Symbol("Symbol.dispose");
+// deno-lint-ignore prefer-primordials
+export const SymbolAsyncDispose = Symbol.asyncDispose ??
+ Symbol("Symbol.asyncDispose");
+
export {
ASCII_ALPHA,
ASCII_ALPHANUMERIC,