From d42f1543121e7245789a96a485d1ef7645cb5fba Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 1 Nov 2023 20:26:12 +0100 Subject: feat: disposable Deno resources (#20845) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit implements Symbol.dispose and Symbol.asyncDispose for the relevant resources. Closes #20839 --------- Signed-off-by: Bartek Iwańczuk Co-authored-by: Bartek Iwańczuk --- ext/web/00_infra.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ext/web/00_infra.js') 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, -- cgit v1.2.3