在构建 XD 插件时使用“eval”
Using `eval` when building XD plugins
是否可以使用 eval
或类似函数来执行 XD 插件文件中的代码?
No. eval
and similar methods of executing code are disabled. This is for a variety of reasons, including security-related concerns.
This doesn’t, however, prevent you from running arbitrary code – it just means you have to get inventive. Before considering this path, however, be sure to consider whether or not you really need to run arbitrary code, as there may be considerable risks to doing so.
部分选项:
- 使用 JavaScript-in-JavaScript 解释器。一些可能的选择:
- 使用数学表达式计算器。一些可能的选择:
- 构建你自己的脚本语言!
- 这假设您喜欢构建解析器、词法分析器等,但对于那些喜欢这样做的人来说,这个选项是可用的!
致谢: Kerri Shotts 来自 Adobe。
是否可以使用 eval
或类似函数来执行 XD 插件文件中的代码?
No.
eval
and similar methods of executing code are disabled. This is for a variety of reasons, including security-related concerns.This doesn’t, however, prevent you from running arbitrary code – it just means you have to get inventive. Before considering this path, however, be sure to consider whether or not you really need to run arbitrary code, as there may be considerable risks to doing so.
部分选项:
- 使用 JavaScript-in-JavaScript 解释器。一些可能的选择:
- 使用数学表达式计算器。一些可能的选择:
- 构建你自己的脚本语言!
- 这假设您喜欢构建解析器、词法分析器等,但对于那些喜欢这样做的人来说,这个选项是可用的!
致谢: Kerri Shotts 来自 Adobe。