phoneGap startup - do we need all those files?

后端 未结 4 1376
日久生厌
日久生厌 2020-12-28 16:37

Alright, I am just getting started with phoneGap for iOS and I am noticing in the www directory that there are plenty of files, such as

spec/helper.js
spec/i         


        
相关标签:
4条回答
  • 2020-12-28 17:01

    The cordova js the only js file needed. This is autogenerated when you ran the phonegap create script.

    index.js contains sample code on how to bind to the deviceready event. It can serve as a start for your js code.

    The spec folder and spec.html are for javascript testing using Jasmine, a BDD testing framework for Javascript.

    0 讨论(0)
  • 2020-12-28 17:06

    No, you don't need all these files.
    Actually, the only file you need is cordova.js.

    0 讨论(0)
  • 2020-12-28 17:16

    Even if the cordova js the only js file needed, you will probably not use some functions that it contains.

    In fact, somewhere in your project you have a config xml file that contains all plugins used by your application (the location of this file dépends on your project Platform). Check this file and remove all unused plugins if you want to have a more performant application. After that, you can remove related functions in the cordova js file (this file interfaces plugins in native code with javascript).

    For example, if you don't want to use compass features of your device, remove the corresponding plugin from the config xml file and also all functions related to the compass in the cordova js file (to perform this operation often save your file and test your project to check if you don't insert some syntax errors).

    I send you a french blog post that gives some other good advices about phonegap performance. Maybe you can use Google translation to read this article...

    http://blog.workinday.com/application_smartphone/184-comment-ameliorer-les-performances-de-son-application-phonegap.html

    Hope this helps ! Bye !

    0 讨论(0)
  • 2020-12-28 17:26

    spec/helper.js spec/index.js jasmine

    You do need these files, if you want to keep your app in Behaviour Driven Development. These are basically for unit testing.

    Cordova.js/Phonegap.js are the scripts that make your application "Phonegapifiable". Adds that extra something on your webapp so that it can be deployed as an app.

    0 讨论(0)
提交回复
热议问题