Class Runtime

java.lang.Object
ws.siri.jscore.runtime.Runtime

public class Runtime extends Object
  • Field Details

    • global

      public static Object global
  • Constructor Details

    • Runtime

      public Runtime()
  • Method Details

    • init

      public static void init()
    • stop

      public static void stop()
    • evaluate

      public static Object evaluate(String expr, List<String> path, boolean isLazy)
    • getPrelude

      public static Optional<String> getPrelude()
    • asJS

      public static Object asJS(Object source)
      Convert a JavaLike to a JSLike
      Parameters:
      source -
      Returns:
    • unwrap

      public static Object unwrap(Object source)
      Unwrap one layer of wrapper
      Parameters:
      source -
      Returns:
    • wrap

      public static Object wrap(Object source)
    • autoWrap

      public static Object autoWrap(Object source)
    • getModule

      public static Module getModule(List<String> path)
      Return the module at path, create a new one if does not exist
      Parameters:
      path -
      Returns:
    • call

      @Nullable public static @Nullable Object call(Path path, String mode, String content)
      Evaluate a file, and returns the value of module.exports
      Parameters:
      path - path from which the expression comes from
      mode - mod to evaluate in: lazy or strict
      content - TODO provide a script instead of using the file content
      Returns:
      module.exports
    • call

      @Nullable public static @Nullable Object call(Path path, String mode, String content, boolean isLazy)
    • getContext

      public static org.mozilla.javascript.Context getContext()