質問

I am currently working on an IBM Worklight project, and I have a phonegap application which needs to be ported to it.

Does anyone have any idea about it?

役に立ちましたか?

解決

Porting phonegap apps to Worklight is often pretty straight forward. The contents of index.html -> Body go into the Worklight App's main HTML -> Body. If you have scripts and css links in the head, those need to be moved over too ... but you don't need to load cordova.js. The Worklight Framework will take care of that for you. It will also by default load jQuery, but you can override the version of jQuery used by your app code if you wish.

If you have processing in a deviceready handler, that should be moved to wlCommonInit. And the rest of the app artifacts should be moved to the correct relative position under the Worklight App's common folder.

After that, you will have to deal with details based on the details of the particular app you are porting, but that should get you started.

他のヒント

You should probably read the IBM Worklight Getting Started training modules...

After doing that, you'll have a better overview and understanding of a Worklight project's application structure and you will then see where you need to place each part of your app (the HTML, CSS, JS, native code if there is any) in the Worklight counterpart.

In addition, it is important to note that it is essential to not simply copy/paste, but to place it in the correct location in the given template of an app.

  • HTML: don't remove the various JS and CSS references that are already there in the HEAD and bottom of file
  • JavaScript: common code goes (usually the logic of the app) into wlCommonInit() in common\{app-name}.js file, which also handles the app once it has been initialized.
  • JavaScript: environment-specific code (UI, etc) goes into wlEnvInit() in envName\{app-name}.js
  • Worklight comes with Cordova (PhoneGap) so all device ready code you may have is not require any longer mostly.

Again, once you read the training modules, it'll be as easy as 1-2-3.

enter image description here

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top