Class JavaScriptWriter

java.lang.Object
de.inetsoftware.jwebassembly.javascript.JavaScriptWriter

public class JavaScriptWriter extends Object
Write JavaScipt glue code.
  • Field Details

  • Constructor Details

    • JavaScriptWriter

      public JavaScriptWriter(WasmTarget target)
      Create a new instance
      Parameters:
      target - the target for the module data.
  • Method Details

    • addImport

      public void addImport(String module, String name, Function<String,Object> annotationValues)
      Add an import from a needed function with import annotation.
      Parameters:
      module - the module name
      name - the function name
      annotationValues - the other values of the annotation
    • finish

      public void finish() throws IOException
      Finish the accumulate of imports and write the JavaScript file.
      Throws:
      IOException - if any I/O error occur
    • finish

      void finish(Appendable out) throws IOException
      Finish the accumulate of imports and write the JavaScript to the Appendable.
      Parameters:
      out - the target for the script
      Throws:
      IOException - if any I/O error occur