Skip to content

Add static using iterator helper#2

Open
mhofman wants to merge 5 commits into
mainfrom
static-using
Open

Add static using iterator helper#2
mhofman wants to merge 5 commits into
mainfrom
static-using

Conversation

@mhofman

@mhofman mhofman commented Nov 1, 2021

Copy link
Copy Markdown
Owner

Add a static using iterator helper that simplifies scoping the disposal of a single resource to a for-of statement.

Throw when calling the using aggregate instance helper after the instance has been disposed of. Ensures that the resource that was attempted to be added for tracking is disposed of first.

Comment thread async-disposable.js

static [Symbol.asyncIterator]() {
/** @type {DisposableAggregate | undefined} */
let res = new (this || Disposable)();

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% refactor I guess, I fixed a previous copy-pasta mistake.

Disposable -> AsyncDisposable

@mhofman mhofman requested a review from kriskowal November 1, 2021 05:07
@kriskowal kriskowal removed their request for review November 29, 2021 23:51
@kriskowal

Copy link
Copy Markdown
Collaborator

I resigned as a reviewer to be realistic about my availability. I’m sure I don’t object to your moving forward!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants