phonegap html5 android synchonous文件系统IO [英] phonegap html5 android synchonous Filesystem IO

查看:139
本文介绍了phonegap html5 android synchonous文件系统IO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用PhoneGaps Filesystem API同步读取和写入文件?
是否有同步包装器可用?

How can I read and write files synchronously, using PhoneGaps Filesystem API? Is there a an synchronous wrapper available?

推荐答案

由于Android上的Java-工作,几乎不可能做同步实现的文件IO。这是因为Android中绑定到JavaScript环境的每个Java对象都运行在自己的线程上。

Because of the way the Java-to-JavaScript bridge on Android works, it is pretty much impossible to do a synchronous implementation of File IO. This is because each Java object in Android that is bound to the JavaScript environment runs on its own thread.

使用现有的 File API 在PhoneGap中可用 - 但异步使用。注册回调,通知您的应用程序IO处理完成。

Use the existing File API available in PhoneGap - but use it asynchronously. Register a callback with it that will notify your app that an IO process is complete.

这篇关于phonegap html5 android synchonous文件系统IO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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