PhoneGap3.0发布,使用全新的插件架构

来源:http://www.newsqueue.net/n/PhoneGap30-release-use-the-new-plug-in-architecture

今天在 PhoneGap Day 会议上 PhoneGap 发布了 3.0 版本,该版本对底层架构进行了全面显著的改进,还包括其他方面的改进。
首先,你可以先阅读以下链接:
Adobe PhoneGap 3.0 Released
What's New in Cordova iOS 3
Introducing Cordova 3 for Android
其次,有一个新的命令行工具你将会使用到(不过 cordova-cli 还可以继续使用),它就是 phonegap,可使用如下命令行来安装该工具:
sudo npm install -g phonegap
很明显 phonegap 命令行工具与 cordova 命令行工具有所不同。最大的不同是新的 phonegap 命令行工具完全支持 PhoneGap Build。其次是可快速的检查 SDK/platforms :

我想 PhoneGap 3.0 最需要关注的是完全的插件体系结构,所有的功能特性包括摄像头等都是使用插件方式提供。也就是说新建项目后很多功能是无法使用的,你必须将其对应的插件添加到项目中。
例如在 cordova 中添加插件的方法是
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
而通过 phonegap 命令行工具的方法是:
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
这意味着在开始 PhoneGap 项目时你要先考虑项目需要什么功能,然后通过命令行来添加这些功能。
下面是完整的插件列表,我直接拷贝过来,可能会有变化:
Basic device information:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
Network and battery status:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status.git
Accelerometer, compass, and geolocation:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
Camera, media capture, and media playback:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git
Access files on device or network:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git
Notifications via dialog box or vibration:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration.git
Contacts:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts.git
Globalization:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization.git
Splash Screen:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git
In-app browser:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
Debug console:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
via raymondcamden/oschina编译

猜你喜欢

转载自lhdst-163-com.iteye.com/blog/1920224