Skip to content

Conversation

ddosakura
Copy link

Add ECMAScript Explicit Resource Management to Resource.

This makes the await using work:

import { create, BaseDirectory } from "@tauri-apps/plugin-fs"
...
{
  await using file = await create("foo/bar.txt", { baseDir: BaseDirectory.AppConfig });
  await file.write(new TextEncoder().encode("Hello world"));
  // Before `file` goes out of scope, it is disposed by calling `file[Symbol.asyncDispose]()` and awaited.
}

@ddosakura ddosakura requested a review from a team as a code owner August 28, 2025 03:58
@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap Aug 28, 2025
Copy link
Contributor

github-actions bot commented Aug 28, 2025

Package Changes Through b47839d

There are 5 changes which include tauri-cli with minor, tauri-bundler with minor, tauri-utils with minor, @tauri-apps/api with minor, @tauri-apps/cli with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.8.0 2.9.0
tauri-utils 2.7.0 2.8.0
tauri-bundler 2.6.1 2.7.0
tauri-runtime 2.8.0 2.8.1
tauri-runtime-wry 2.8.1 2.8.2
tauri-codegen 2.4.0 2.4.1
tauri-macros 2.4.0 2.4.1
tauri-plugin 2.4.0 2.4.1
tauri-build 2.4.1 2.4.2
tauri 2.8.5 2.8.6
@tauri-apps/cli 2.8.4 2.9.0
tauri-cli 2.8.4 2.9.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master Legend-Master added this to the 2.9 milestone Aug 28, 2025
@Legend-Master
Copy link
Contributor

Thanks for bring this up!

I have one question though, I believe Symbol.asyncDispose doesn't exist on older browsers, should we provide a polyfill here?

Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management:~:text=Symbol.asyncDispose%20%3F%3F%3D%20Symbol(%22Symbol.asyncDispose%22)%3B

cc @lucasfernog @FabianLars

@FabianLars
Copy link
Member

Not only older browsers but webkit as a whole as well which means this is a Windows only change.

@Legend-Master
Copy link
Contributor

Legend-Master commented Sep 2, 2025

but webkit as a whole

Technically it's a coming soon https://webkit.org/blog/16993/news-from-wwdc25-web-technology-coming-this-fall-in-safari-26-beta/ but yeah, this is still useful for people using the transpiler/polyfill themselves though

@FabianLars
Copy link
Member

hmm true but having macos 26 as a minimum version sounds a bit problematic (and who knows when/if linux follows)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📬Proposal
Development

Successfully merging this pull request may close these issues.

3 participants