import { using } from "https://deno.land/x/websocket_broadcastchannel@0.8.0/src/using.ts";
Similar to the TC39 proposal for using
blocks, named Explicit Resource
Management.
Give this a bunch of functions that each create a resource
(resourceFactories
), and a function that uses those resources (fn
). It
will call the resourceFactories
, then pass their resources to fn
. Then
"finally" it will [Symbol.dispose]?.()
, await [Symbol.asyncDispose]?.()
,
and await close?.()
all the resources.