JavaScript resource management - JavaScript | MDN

developer.mozilla.org

Tin mới

HTML: Markup language

See all HTML references

Date & time formats

See all HTML guides

CSS: Styling language

See all CSS references

See all CSS guides

Centering an element

JavaScript: Scripting language

Standard built-in objects

Expressions & operators

Statements & declarations

See all JavaScript references

Control flow & error handing

Loops and iteration

Working with objects

See all JavaScript guides

Web APIs: Programming interfaces

Service worker API

Using the Web animation API

Using the Fetch API

Working with the History API

Using the Web speech API

All web technology

Progressive web apps

Learn web development

Getting started modules

Structuring content with HTML module

CSS styling basics module

Dynamic scripting with JavaScript module

Border-image generator

Border-radius generator

Box-shadow generator

Color format converter

FinalizationRegistry

ReadableStreamDefaultReader.releaseLock()

Stream readers: If you don't call ReadableStreamDefaultReader.releaseLock(), the stream will be locked and does not permit another reader to consume it.

The using and await using declarations

The solution we have is two special kinds of variable declaration: using and await using. They are similar to const, but they automatically release the resource when the variable goes out of scope as long as the resource

The using and await using declarations

The solution we have is two special kinds of variable declaration: using and await using. They are similar to const, but they automatically release the resource when the variable goes out of scope as long as the resource

ReadableStreamDefaultReader

Note: At the time of writing, ReadableStreamDefaultReader does not implement the disposable protocol. This is a hypothetical example.

The using and await using declarations

The solution we have is two special kinds of variable declaration: using and await using. They are similar to const, but they automatically release the resource when the variable goes out of scope as long as the resource

The using and await using declarations

The solution we have is two special kinds of variable declaration: using and await using. They are similar to const, but they automatically release the resource when the variable goes out of scope as long as the resource

[Symbol.dispose]()

The solution we have is two special kinds of variable declaration: using and await using. They are similar to const, but they automatically release the resource when the variable goes out of scope as long as the resource

[Symbol.asyncDisposable]()

The solution we have is two special kinds of variable declaration: using and await using. They are similar to const, but they automatically release the resource when the variable goes out of scope as long as the resource

The DisposableStack and AsyncDisposableStack objects

using and await using are special syntaxes. Syntaxes are convenient and hide a lot of the complexity, but sometimes you need to do things manually.

The DisposableStack and AsyncDisposableStack objects

using and await using are special syntaxes. Syntaxes are convenient and hide a lot of the complexity, but sometimes you need to do things manually.

The DisposableStack and AsyncDisposableStack objects

using and await using are special syntaxes. Syntaxes are convenient and hide a lot of the complexity, but sometimes you need to do things manually.

The DisposableStack and AsyncDisposableStack objects

using and await using are special syntaxes. Syntaxes are convenient and hide a lot of the complexity, but sometimes you need to do things manually.

Automatically releasing object URLs

URL.revokeObjectURL()

Automatically canceling in-progress requests