Skip to main content

在沙箱中提供一个 VSCode 实例

Deno Sandboxes provide a sandboxed environment for evaluating JavaScript code. This is useful for evaluating code that is not trusted or for testing code that is not safe to run in the main runtime.

sandbox.vscode() 方法可以用来在沙箱中提供一个 VSCode 实例。

本示例展示了如何在沙箱中启动一个 VSCode 实例,并打印正在运行实例的 URL,您可以在浏览器中打开该链接。

import { Sandbox } from "@deno/sandbox";

await using sandbox = await Sandbox.create();

// 启动一个 VSCode 实例
const vscode = await sandbox.vscode();

console.log(vscode.url); // 打印正在运行实例的 URL
await vscode.status; // 等待直到它退出

For more information about Sandboxes, see the Sandboxes documentation.

你找到了你需要的东西吗?

编辑此页面
隐私政策