类:RunScope


🌐 Class: RunScope

稳定性: 1 - 实验性

asyncLocalStorage.withScope() 返回的一次性作用域,在被释放时会自动恢复之前的存储值。此类实现了 显式资源管理 协议,并设计为与 JavaScript 的 using 语法一起使用。

🌐 A disposable scope returned by asyncLocalStorage.withScope() that automatically restores the previous store value when disposed. This class implements the Explicit Resource Management protocol and is designed to work with JavaScript's using syntax.

无论是通过正常完成还是抛出错误,当 using 块退出时,该作用域会自动恢复之前的存储值。

🌐 The scope automatically restores the previous store value when the using block exits, whether through normal completion or by throwing an error.