简体   繁体   English

JXCore Cordova =>本机Cordova插件(无法访问cordova.exec(…))

[英]JXCore Cordova => Native Cordova Plugin (can't reach cordova.exec(…))

I'm using the JXCore Cordova Plugin to get my Node.js Application running on mobile devices. 我正在使用JXCore Cordova插件来使我的Node.js应用程序在移动设备上运行。 I also wrote a native cordova plugin, to process some tasks in native part of the application. 我还编写了一个本地cordova插件,以处理应用程序本机部分中的某些任务。

But I can't reach the native cordova plugin. 但是我找不到原生的cordova插件。 Is this the right approach to do this? 这是正确的方法吗?

1. Register method from UI to jxcore instance ( index.js ): 1.将方法从UI注册到jxcore实例index.js ):
jxcore('someNativeExtension').register(someTriggerMethod); jxcore( 'someNativeExtension')寄存器(someTriggerMethod)。
(where the trigger does something like cordova.exec(...);) (触发器执行的操作类似于cordova.exec(...);)

2. Start Node ( index.js ): 2.启动Nodeindex.js ):
jxcore('app.js').loadMainFile(callback); jxcore( 'app.js')loadMainFile(回调)。
(after this step I move to another index.html, that is served by express.js: (在此步骤之后,我转到另一个由express.js提供服务的index.html:
=> window.open(' http://localhost:8080/apps/backend/index.html ','_blank');) => window.open(' http:// localhost:8080 / apps / backend / index.html ','_ blank');)

3. Call method from Node ( app.js ): 3.从Nodeapp.js调用方法
Mobile('someNativeExtension').call(); 中移动( 'someNativeExtension')()调用。

But this snippet doesn't work, because it seems, that cordova.js isn't present, after I receive another html file. 但是此代码段不起作用,因为在我收到另一个html文件后,似乎cordova.js不存在。 Do you have Any Idea, how to fix this? 您有任何想法,如何解决?

When you browse another URL, cordova client side files are not loaded with that URL. 当您浏览另一个URL时,cordova客户端文件不会随该URL一起加载。 Since you have the control for the loaded HTML page, that page can load cordova + jxcore JS files 由于您拥有加载HTML页面的控件,因此该页面可以加载cordova + jxcore JS文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM