Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/disposable/mod.ts>usingSync

🦕 Ensure a disposable resource is disposed in Deno
Go to Latest
function usingSync
import { usingSync } from "https://deno.land/x/disposable@v1.1.0/mod.ts";

Ensure a synchronous disposable resource is disposed

It invokes 'dispose()' method of the resource prior to leave the inner function. It suppors only synchronous disposable.

Type Parameters

T extends Disposable<void>
optional
R = unknown

Parameters

resource: T
fn: (resource: T) => R