generate the Node.ELEMENT_NODE fields on the JS DOM API and refactored the kotlin.dom API so that it uses the Node.getNodeType() API rather than using "is" which is troublesome to implement on a browser/JS
This commit is contained in:
@@ -4,6 +4,7 @@ import java.io.File
|
||||
import java.io.FileWriter
|
||||
import java.io.PrintWriter
|
||||
import org.w3c.dom.*
|
||||
import java.lang.reflect.Modifier
|
||||
|
||||
/**
|
||||
* This tool generates JavaScript stubs for classes available in the JDK which are already available in the browser environment
|
||||
@@ -67,6 +68,26 @@ import js.noImpl
|
||||
}
|
||||
}
|
||||
}
|
||||
val fields = klass.getDeclaredFields()
|
||||
if (fields != null) {
|
||||
for (field in fields) {
|
||||
if (field != null) {
|
||||
val modifiers = field.getModifiers()
|
||||
if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
|
||||
try {
|
||||
val value = field.get(null)
|
||||
if (value != null) {
|
||||
val fieldType = simpleTypeName(field.getType())
|
||||
println(" public val ${field.getName()}: $fieldType = $value")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
println("Caught: $e")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
println("}")
|
||||
println("")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user