On 29-10-2014 10:51, Iovene, Salvatore wrote:
Hi,
On Tue, Oct 28, 2014 at 4:31 PM, Thiago Marcos P. Santos
<[email protected]> wrote:
Extensions are dynamically loaded when the user touches the extension
namespace (i.e. window.myExtension). If you have an entry point outside the
extension namespace you have to explicitly declare it.
Thanks, that's the key point. However, now I have to force the users
of the extension to touch the extension by referencing
`window.myExtension`.
I can document it, but it's really not ideal.
You don't need to tell your users to touch window.myExtension. You need
to explicitly mark it as an entry point.
I found a code example inside Crosswalk about how to do it in Java:
public class LaunchScreenExtension extends XWalkExtension {
public final static String JS_API_PATH = "jsapi/launch_screen_api.js";
private final static String NAME = "xwalk.launchscreen";
private final static String[] JS_ENTRY_POINTS = {
"window.screen.show"
};
public LaunchScreenExtension(String jsApi, XWalkExtensionContext
context) {
super(NAME, jsApi, JS_ENTRY_POINTS, context);
}
In this case, it is marking "window.screen.show" as an external entry
point for the API. You just replace it with something like
"window.navigator.watherver" and you are good.
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help