netlogix / eel-javascript
Neos Eel Helper 用于嵌入内联 JavaScript
1.0.0
2024-07-19 13:52 UTC
Requires
- matthiasmullie/minify: ^1.3
- neos/eel: ^7.3 || ^8.3
- neos/flow: ^7.3 || ^8.3
- neos/fusion: ^7.3 || ^8.3
README
Neos Eel Helper 用于从文件中嵌入内联 JavaScript。
安装
composer require netlogix/eel-javascript
使用方法
您可以在 Fusion 文件中使用 JavaScriptHelper,如下所示
无变量脚本
要包含不需要外部变量的脚本,您可以使用 embed
方法。
script = ${Netlogix.JavaScript.embed('resource://Netlogix.Eel.JavaScript/Private/ScriptWithVars.js')}
带变量脚本
要包含需要外部变量的脚本,您可以使用 embedWithVariables
方法。
scriptWithVars = ${Netlogix.JavaScript.embedWithVariables('resource://Netlogix.Eel.JavaScript/Private/ScriptWithVars.js', {'someVariableName': 'someValue'})}
这将使用传递给方法变量的前缀来包含引入的 JavaScript 文件
var someVariable= 'someValue'; /// ... your script ScriptWithVars.js