phonegap html5 android synchonous Filesystem IO

浪子不回头ぞ 提交于 2019-12-24 03:29:45

问题


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


回答1:


There is no way to access files synchronously through the provided api. Guessing from the way phonegap is implemented i doubt that you can write a plugin to do this synchronously.




回答2:


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.

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.



来源:https://stackoverflow.com/questions/4846949/phonegap-html5-android-synchonous-filesystem-io

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!