Class JavascriptEngineHandler
java.lang.Object
com.bencodez.advancedcore.api.javascript.JavascriptEngineHandler
Handler for Javascript engine creation across different Java versions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cached JavaScript engine.voidCloses the current downloaded class loader.Gets a Javascript script engine.voidinit(AdvancedCorePlugin plugin, boolean enabled, boolean autoDownload) Initializes the Javascript engine handler.booleanPrepares the Javascript engine so dependencies are downloaded and the engine is ready before first use.
-
Constructor Details
-
JavascriptEngineHandler
public JavascriptEngineHandler()Creates a new Javascript engine handler.
-
-
Method Details
-
init
Initializes the Javascript engine handler.- Parameters:
plugin- AdvancedCore plugin instanceenabled- true if Javascript support is enabledautoDownload- true if missing Nashorn dependencies should be downloaded
-
prepareEngine
public boolean prepareEngine()Prepares the Javascript engine so dependencies are downloaded and the engine is ready before first use.- Returns:
- true if an engine is ready, false otherwise
-
getJSScriptEngine
Gets a Javascript script engine.- Returns:
- the script engine
-
closeExistingClassLoader
public void closeExistingClassLoader()Closes the current downloaded class loader. -
clearCachedEngine
public void clearCachedEngine()Clears the cached JavaScript engine.
-