java.lang.Object
com.iamsoft.util.ui.javafx.script.PolyglotUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Callable
<T> createTask
(String pSource, String pLanguageId, Function<org.graalvm.polyglot.Value, T> pResultMapper, Supplier<org.graalvm.polyglot.Context> pContextSupplier, long pTimeoutMs, Consumer<org.graalvm.polyglot.Context> pBeforeEval, Consumer<org.graalvm.polyglot.Context> pAfterEval, Consumer<org.graalvm.polyglot.Context> pOnContextClosing) Evaluates the specified code using the specified context and executor and waits for result without blocking the UI.static <T> void
eval
(String pSource, String pLanguageId, Function<org.graalvm.polyglot.Value, T> pResultMapper, BiConsumer<T, Exception> pResultConsumer, Supplier<org.graalvm.polyglot.Context> pContextSupplier, Consumer<Runnable> pExecutor, long pTimeoutMs, Consumer<org.graalvm.polyglot.Context> pBeforeEval, Consumer<org.graalvm.polyglot.Context> pAfterEval, Consumer<org.graalvm.polyglot.Context> pOnContextClosing) static <T> T
eval
(String pSource, String pLanguageId, Function<org.graalvm.polyglot.Value, T> pResultMapper, Supplier<org.graalvm.polyglot.Context> pContextSupplier, Consumer<Runnable> pExecutor, long pTimeoutMs, Consumer<org.graalvm.polyglot.Context> pBeforeEval, Consumer<org.graalvm.polyglot.Context> pAfterEval, Consumer<org.graalvm.polyglot.Context> pOnContextClosing) Evaluates the specified code using the specified context and executor and waits for result without blocking the UI.static <T> T
eval
(String pSource, String pLanguageId, Function<org.graalvm.polyglot.Value, T> pResultMapper, org.graalvm.polyglot.Context pContext, Consumer<Runnable> pExecutor, long pTimeoutMs) Evaluates the specified code using the specified context executor and waits for result without blocking the UI.static <T> T
eval
(String pSource, String pLanguageId, Map<String, Object> pVarMap, Function<org.graalvm.polyglot.Value, T> pResultMapper, Supplier<org.graalvm.polyglot.Context> pContextSupplier, Consumer<Runnable> pExecutor, long pTimeoutMs, Consumer<org.graalvm.polyglot.Context> pOnContextClosing) Evaluates the specified code using the specified context and executor and waits for result without blocking the UI.static <T> T
Evaluates the specified JavaScript code on a background thread and waits for result without blocking the UI.static <T> T
jsEval
(String pSource, Function<org.graalvm.polyglot.Value, T> pResultMapper, Consumer<Runnable> pExecutor, long pTimeoutMs) Evaluates the specified JavaScript code using the specified executor and waits for result without blocking the UI.static String
jsEvalString
(String pSource, long pTimeoutMs) Evaluates the specified JavaScript code on a background thread and waits for result without blocking the UI.static String
jsEvalString
(String pSource, Consumer<Runnable> pExecutor, long pTimeoutMs) Evaluates the specified JavaScript code using the specified executor and waits for result without blocking the UI.
-
Field Details
-
LANGUAGE_MAP
-
-
Method Details
-
jsEval
public static <T> T jsEval(String pSource, Function<org.graalvm.polyglot.Value, T> pResultMapper, long pTimeoutMs) throws InterruptedExceptionEvaluates the specified JavaScript code on a background thread and waits for result without blocking the UI. This method should be invoked only from the JavaFX thread. This method must either be called from an input event handler or from the run method of a Runnable passed toPlatform.runLater
. It must not be called during animation or layout processing.- Throws:
InterruptedException
- if the specified timeout is reached
-
jsEval
public static <T> T jsEval(String pSource, Function<org.graalvm.polyglot.Value, T> pResultMapper, Consumer<Runnable> pExecutor, long pTimeoutMs) throws InterruptedExceptionEvaluates the specified JavaScript code using the specified executor and waits for result without blocking the UI. This method should be invoked only from the JavaFX thread. This method must either be called from an input event handler or from the run method of a Runnable passed toPlatform.runLater
. It must not be called during animation or layout processing.- Throws:
InterruptedException
- if the specified timeout is reached
-
eval
public static <T> T eval(String pSource, String pLanguageId, Function<org.graalvm.polyglot.Value, T> pResultMapper, org.graalvm.polyglot.Context pContext, Consumer<Runnable> pExecutor, long pTimeoutMs) throws InterruptedExceptionEvaluates the specified code using the specified context executor and waits for result without blocking the UI. This method should be invoked only from the JavaFX thread. This method must either be called from an input event handler or from the run method of a Runnable passed toPlatform.runLater
. It must not be called during animation or layout processing.- Throws:
InterruptedException
- if the specified timeout is reached
-
eval
public static <T> T eval(String pSource, String pLanguageId, Map<String, Object> pVarMap, Function<org.graalvm.polyglot.Value, throws InterruptedExceptionT> pResultMapper, Supplier<org.graalvm.polyglot.Context> pContextSupplier, Consumer<Runnable> pExecutor, long pTimeoutMs, Consumer<org.graalvm.polyglot.Context> pOnContextClosing) Evaluates the specified code using the specified context and executor and waits for result without blocking the UI. This method should be invoked only from the JavaFX thread. This method must either be called from an input event handler or from the run method of a Runnable passed toPlatform.runLater
. It must not be called during animation or layout processing.- Throws:
InterruptedException
- if the specified timeout is reached
-
eval
public static <T> void eval(String pSource, String pLanguageId, Function<org.graalvm.polyglot.Value, T> pResultMapper, BiConsumer<T, Exception> pResultConsumer, Supplier<org.graalvm.polyglot.Context> pContextSupplier, Consumer<Runnable> pExecutor, long pTimeoutMs, Consumer<org.graalvm.polyglot.Context> pBeforeEval, Consumer<org.graalvm.polyglot.Context> pAfterEval, Consumer<org.graalvm.polyglot.Context> pOnContextClosing) -
eval
public static <T> T eval(String pSource, String pLanguageId, Function<org.graalvm.polyglot.Value, T> pResultMapper, Supplier<org.graalvm.polyglot.Context> pContextSupplier, Consumer<Runnable> pExecutor, long pTimeoutMs, Consumer<org.graalvm.polyglot.Context> pBeforeEval, Consumer<org.graalvm.polyglot.Context> pAfterEval, Consumer<org.graalvm.polyglot.Context> pOnContextClosing) throws InterruptedExceptionEvaluates the specified code using the specified context and executor and waits for result without blocking the UI. This method should be invoked only from the JavaFX thread. This method must either be called from an input event handler or from the run method of a Runnable passed toPlatform.runLater
. It must not be called during animation or layout processing.- Throws:
InterruptedException
- if the specified timeout is reached
-
createTask
public static <T> Callable<T> createTask(String pSource, String pLanguageId, Function<org.graalvm.polyglot.Value, T> pResultMapper, Supplier<org.graalvm.polyglot.Context> pContextSupplier, long pTimeoutMs, Consumer<org.graalvm.polyglot.Context> pBeforeEval, Consumer<org.graalvm.polyglot.Context> pAfterEval, Consumer<org.graalvm.polyglot.Context> pOnContextClosing) Evaluates the specified code using the specified context and executor and waits for result without blocking the UI. This method should be invoked only from the JavaFX thread. This method must either be called from an input event handler or from the run method of a Runnable passed toPlatform.runLater
. It must not be called during animation or layout processing.- Throws:
InterruptedException
- if the specified timeout is reached
-
jsEvalString
Evaluates the specified JavaScript code on a background thread and waits for result without blocking the UI. This method should be invoked only from the JavaFX thread. This method must either be called from an input event handler or from the run method of a Runnable passed toPlatform.runLater
. It must not be called during animation or layout processing.- Throws:
InterruptedException
- if the specified timeout is reached
-
jsEvalString
public static String jsEvalString(String pSource, Consumer<Runnable> pExecutor, long pTimeoutMs) throws InterruptedException Evaluates the specified JavaScript code using the specified executor and waits for result without blocking the UI. This method should be invoked only from the JavaFX thread. This method must either be called from an input event handler or from the run method of a Runnable passed toPlatform.runLater
. It must not be called during animation or layout processing.- Throws:
InterruptedException
- if the specified timeout is reached
-