Class JavaScriptWriter
- java.lang.Object
-
- de.inetsoftware.jwebassembly.javascript.JavaScriptWriter
-
public class JavaScriptWriter extends java.lang.Object
Write JavaScipt glue code.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
JAVA_SCRIPT_CONTENT
annotation attribute for the JavaScript contentprivate java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.function.Function<java.lang.String,java.lang.Object>>>
modules
private WasmTarget
target
-
Constructor Summary
Constructors Constructor Description JavaScriptWriter(WasmTarget target)
Create a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addImport(java.lang.String module, java.lang.String name, java.util.function.Function<java.lang.String,java.lang.Object> annotationValues)
Add an import from a needed function with import annotation.void
finish()
Finish the accumulate of imports and write the JavaScript file.(package private) void
finish(java.lang.Appendable out)
Finish the accumulate of imports and write the JavaScript to the Appendable.
-
-
-
Field Detail
-
target
private WasmTarget target
-
JAVA_SCRIPT_CONTENT
static final java.lang.String JAVA_SCRIPT_CONTENT
annotation attribute for the JavaScript content- See Also:
- Constant Field Values
-
modules
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.function.Function<java.lang.String,java.lang.Object>>> modules
-
-
Constructor Detail
-
JavaScriptWriter
public JavaScriptWriter(WasmTarget target)
Create a new instance- Parameters:
target
- the target for the module data.
-
-
Method Detail
-
addImport
public void addImport(java.lang.String module, java.lang.String name, java.util.function.Function<java.lang.String,java.lang.Object> annotationValues)
Add an import from a needed function with import annotation.- Parameters:
module
- the module namename
- the function nameannotationValues
- the other values of the annotation
-
finish
public void finish() throws java.io.IOException
Finish the accumulate of imports and write the JavaScript file.- Throws:
java.io.IOException
- if any I/O error occur
-
finish
void finish(java.lang.Appendable out) throws java.io.IOException
Finish the accumulate of imports and write the JavaScript to the Appendable.- Parameters:
out
- the target for the script- Throws:
java.io.IOException
- if any I/O error occur
-
-