注意:在 markdown 文件中为了描述方便,用<file path="...">...content...</file>包裹表示src路径下需要写的文件路径和内容。如果直接是 src 目录中的文件,则不需要包裹 file 标签或代码块标记。
$BackendVariable({
description: '服务端全局变量1'
})
export let backendVariable1: String = '123';
$FrontendVariable({
description: '前端全局变量',
localStorage: true,
})
export let frontendVariable2: String;
- httpRequest, httpResponse, currentUser 为服务端只读全局变量,不可修改,只可使用
- `currentUser` 的字段含义、与 `nasl.auth.getCurrentUser()` / 前端 `nasl.auth.userInfo` 的端侧区分见 nasl-book/K011-nasl--current-user-and-nasl-auth.md
- localStorage: 开启后,变量的读写均绑定到 localStorage 中对应的 item,复杂数据类型会自动进行序列化和反序列化。起到本地缓存的作用。