-
Notifications
You must be signed in to change notification settings - Fork 174
Open
Labels
addition/proposalNew features or enhancementsNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interestMoving the issue forward requires implementers to express interest
Description
What problem are you trying to solve?
https://github.com/tc39/proposal-explicit-resource-management is stage 3, with at least V8 starting to ship. Standards should be able to integrate with that with their existing disposer methods.
What solutions exist today?
Many standards have methods like .close()
, .abort()
, and so on.
How would you solve it?
Add a disposer
keyword that interfaces can use to alias a method to Symbol.dispose
, and a similar async_disposer
for Symbol.asyncDispose
.
- All parameters must be optional.
async_disposer
s must return promises.
For a few examples:
[Exposed=(Window,Worker)]
interface WebSocket : EventTarget {
// ...
disposer undefined close(optional [Clamp] unsigned short code, optional USVString reason);
// ...
};
interface mixin ReadableStreamGenericReader {
readonly attribute Promise<undefined> closed;
async_disposer Promise<undefined> cancel(optional any reason);
};
[Exposed=(Window,Worker)]
interface IDBTransaction : EventTarget {
// ...
undefined commit();
disposer undefined abort();
// ...
};
Anything else?
No response
nektro
Metadata
Metadata
Assignees
Labels
addition/proposalNew features or enhancementsNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interestMoving the issue forward requires implementers to express interest