netlogix/eel-javascript

Neos Eel Helper to embed inline JavaScript

Installs: 1 659

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 5

Forks: 0

Type:neos-package

1.0.0 2024-07-19 13:52 UTC

This package is auto-updated.

Last update: 2024-11-04 08:59:09 UTC


README

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