I'm struggling to understand how "native method" calls in DukeScript work.
In particular, the ones where no body is specified in the @JavascriptBody annotation. For example:
@JavaScriptResource(value = "userEntryComponent.js")
public final class UserEntryWidget {
private UserEntryWidget() {
}
@JavaScriptBody(args = {}, body = "")
public static native void registerComponent();
}
Where is the "registerComponent()" method defined?
In knockout there's a javascript function called "ko.components.register".
So "registerComponent" must be a sort of wrapper around "ko.components.register".
Another example of a native method call without body is here:
@JavaScriptResource("jquery-1.11.0.min.js")
public class JQuery {
@JavaScriptBody(args = {},body="")
public static native void init();
}
So, in this case, what's "init()"? is it a Java method or a JavaScript function?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…