在凌动,我能够调试安装的扩展通过打开开发者工具(Option+ Cmd+ I),并通过JavaScript文件浏览~/.atom/packages,如
是否可以在 VSCode 中执行此操作?通过Help -> Toggle Developer Tools打开开发者工具后,我能找到的唯一与扩展相关的文件是图标图像:
我正在尝试构建pty.js以便在node-webkit(即nw.js)v0.8.6中使用:
mkdir testapp && cd testapp
nvm use 0.10.36
npm install -g nw-gyp
npm install pty.js
cd node_modules/pty.js
# Build the native addon for node-webkit v0.8.6:
nw-gyp configure --target=0.8.6 && nw-gyp build
Run Code Online (Sandbox Code Playgroud)
使用简单的app.js和index.html,应用程序在JavaScript控制台中启动时没有错误:
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<script src="app.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
// app.js
var pty = require('pty.js');
var term = pty.spawn('bash', [], {
name: …Run Code Online (Sandbox Code Playgroud) TypeScript (v3.2.2) 允许我定义接口的联合,每个接口都有一个唯一的字符串文字属性,可以用作类型保护,例如
type Device = Laptop | Desktop | Phone;
interface Laptop {
type: 'Laptop';
countDriveBays: number;
hasTouchScreen: boolean;
}
interface Desktop {
type: 'Desktop';
countDriveBays: number;
}
interface Phone {
type: 'Phone';
hasTouchScreen: boolean;
}
function printInfo(device: Device) {
if (device.type === 'Laptop') {
// device: Laptop
console.log(
`A laptop with ${device.countDriveBays} drive bays and ${
device.hasTouchScreen ? 'a' : 'no'
} touchscreen.`,
);
} else if (device.type === 'Desktop') {
// device: Desktop
console.log(`A desktop with ${device.countDriveBays} …Run Code Online (Sandbox Code Playgroud)