[英]Phonegap cordova.js on pc
I'm developing app with PhoneGap
. 我正在使用
PhoneGap
开发应用程序。
Most of the things I test on pc in normal browser
rather than on my device
. 我在PC上使用普通
browser
而不是在device
上测试的大多数东西。
But now I need to test things that uses cordova.js
stuff that is not included in www directory. 但是,现在我需要测试使用www目录中未包含的
cordova.js
内容的东西。 There is different cordova.js
file for each platform
so I'm not sure what to include to www
index.html
file so I can test in on pc? 每个
platform
都有不同的cordova.js
文件,因此我不确定要在www
index.html
文件中包括什么内容,以便可以在PC上进行测试?
Is it possible and am I doing it right? 有可能吗,我做对了吗?
I'm aware that cordova.js is included during building process, but I've found testing on pc useful and thats why I would like to include it (for development time at least) 我知道在构建过程中会包含cordova.js,但是我发现在PC上进行测试很有用,这就是为什么我要包含它(至少在开发时间)
Even if you add a cordova.js it will be useless without the native code it calls. 即使添加cordova.js,如果没有它调用的本机代码,它也将是无用的。
I don't think it makes any sence trying to test native functionnalities in your pc. 我认为尝试在您的PC中测试本机functionnalness毫无意义。 You should really test either on real devices or in emulators.
您应该真正在真实设备或仿真器上进行测试。
You could have a look at ripple to be able to test cordova functions in chrome : http://emulate.phonegap.com/ 您可以看一下涟漪图,以测试chrome中的cordova功能: http : //emulate.phonegap.com/
But again, it will not replace testings in real devices (cordova tends to have different behaviours with each version of android for example) 但同样,它不会代替真实设备中的测试(例如,cordova的每个版本的Android都有不同的行为)
You always want to make any changes in the base www
folder. 您始终希望在基本
www
文件夹中进行任何更改。 There should be a platforms folder
, plugin folder
and www folder
in the root of the project. 在项目的根目录中应该有一个
platforms folder
, plugin folder
和www folder
。 The reason you want to modify that www folder
in the root of the project is because anytime you rebuild the application is clears out everything in the platforms folder
您想要修改项目根目录中的
www folder
的原因是因为任何时候重建应用程序都会清除platforms folder
所有内容
So for an example I have a platforms/ios
and a platforms/android
that contains a www folder inside of those as well but each time I run phonegap build android
or phonegap build ios
it recreates every file within those directories 因此,例如,我有一个
platforms/ios
和一个platforms/android
,其中也包含一个www文件夹,但是每次我运行phonegap build android
或phonegap build ios
它都会重新创建这些目录中的每个文件
So you'd want to make code changes in the root www
folder and copy over the changes to the platforms/android/assets/www
folder or platforms/ios/www
then navigate to that directory in the browser 因此,您想在根
www
文件夹中进行代码更改,然后将更改复制到platforms/android/assets/www
文件夹或platforms/ios/www
然后在浏览器中导航到该目录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.