Phonegap:最简单的方式来存储数据/ Phonegap参考 [英] Phonegap: easiest way to store data / Phonegap reference

查看:143
本文介绍了Phonegap:最简单的方式来存储数据/ Phonegap参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找以下资讯:




  • 完整的Phonegap参考资料(在他们的网站上找不到)

  • 在Phonegap中实现数据库最简单的方法是什么?


解决方案

p> 2015年更新



下面的答案是非常出的日期(因为它最近有一个upvote我认为我更好地readdress它) Cordova文档现在是文档的最终位置,但目前的插件docs链接到NPM页面,这是一种转型和混乱。至于存储日期的最佳方式,内置到webkit中的sqllite数据库已经过时或已过时。 草坪椅是过去5年的事实标准,因为您可以将存储引擎交换出去,LocalStorage是存储数据的最简单的方法,但要小心你大约5兆最大(我已经遇到了腐败问题与它)。我建议看看像 sqllite 插件,如果你需要超过5兆(它也有一个LawnChair适配器)或 PouchDB 及其 Cordova Adapter 如果你需要同步到云端。



我已经留下了原来的答案。



Wiki 是phonegap最接近的一个完整的引用,虽然这不是在他们的网站上最容易找到的东西。 Javascript API 网页可能是外部使用的最完整参考功能可用,虽然它可能有点过时。你可以做的最好的事情,如果某些东西不能像记录的一样,去Javascript的API是去Javascript源(不同的设备,在iphone中,你可以去 github ,查看javascript类并查看其确切参数(你可能需要挖掘源代码的其他部分才能看到发生了什么,但是所有代码都很简单)。



对于实现数据库,最好的办法是使用sqlite数据库into webkit 。Jonathan Stark的精彩书,使用HTML构建iPhone应用程序, CSS和JavaScript ,具有这样做。


I'm looking for the following info:

  • Full Phonegap reference (couldn't find it on their site)
  • What's the easiest way to implement a database within Phonegap?

解决方案

Update 2015

The answer below is very out date (and since it recently got an upvote I thought I better readdress it), the Cordova Docs is now the definitive place for documentation, though currently the plugin docs link to the NPM pages which are kind of in transition and a mess. As for the best way to store date, sqllite database that was built into webkit is either gone or deprecated. Lawnchair has been the defacto standard for the past 5 years, as you could swap storage engines in and out, LocalStorage is the simplest way to store data, but beware you around a 5 megs maximum (and I have run into corruption issues with it). I would recommend looking at something like sqllite plugin if you need more than 5 megs (it also has a LawnChair adaptor), or PouchDB and its Cordova Adaptor if you need syncronization to the cloud.

I've left the original answer for posterity...

Original Answer - Circa 2010

The Wiki is the closest thing that phonegap has to a full reference, though it isn't the easiest thing to find on their site. The Javascript API page is probably the most complete reference on external functions available, although it may be a little out of date. The best thing you can do, if something isn't functioning as documented, is go to the Javascript API is to go to the Javascript source (which differs from device to device, in iphone for example, you can go to github and look at the javascript classes and see their exact parameters (you may have to dig into other parts of the source code to see exactly what is going on, but all of the code is pretty straightforward).

As for implementing a database, the best thing to use is the sqlite database built into webkit. Jonathan Stark's excellent book, Building iPhone Apps with HTML, CSS, and JavaScript, has a chapter on doing this.

这篇关于Phonegap:最简单的方式来存储数据/ Phonegap参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆