Class JavaScriptWriter
- java.lang.Object
-
- de.inetsoftware.jwebassembly.javascript.JavaScriptWriter
-
public class JavaScriptWriter extends java.lang.ObjectWrite JavaScipt glue code.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringJAVA_SCRIPT_CONTENTannotation 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>>>modulesprivate WasmTargettarget
-
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 voidaddImport(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.voidfinish()Finish the accumulate of imports and write the JavaScript file.(package private) voidfinish(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.IOExceptionFinish 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.IOExceptionFinish 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
-
-