Skip to content

Neos Eel Helper to embed inline JavaScript

License

Notifications You must be signed in to change notification settings

netlogix/Netlogix.Eel.JavaScript

Repository files navigation

Netlogix.Eel.JavaScript

Neos Eel Helper to embed inline JavaScript from files.

Installation

composer require netlogix/eel-javascript

Usage

You can use the JavaScriptHelper in your Fusion files like this:

Scripts without Variables

To include scripts that don't require external variables, you can use the embed method.

script = ${Netlogix.JavaScript.embed('resource://Netlogix.Eel.JavaScript/Private/ScriptWithVars.js')}

Scripts with Variables

To include scripts that require external variables, you can use the embedWithVariables method.

scriptWithVars = ${Netlogix.JavaScript.embedWithVariables('resource://Netlogix.Eel.JavaScript/Private/ScriptWithVars.js', {'someVariableName': 'someValue'})}

This will prefix the included javascript file with the variables passed to the method:

var someVariable= 'someValue';
/// ... your script ScriptWithVars.js