使用cordova文件插件下载文件时使用window.resolveLocalFileSystemURLvs有什么区别window.requestFileSystem?我找不到关于resolveLocalFileSystemURL的任何文档,但它工作正常,它更容易使用?
我应该在cordova应用程序中使用哪一个简单的CRUD操作?
(我用cordova 3.4.0-0.1.3)
我这样使用它:
function onResolveSuccess(fileEntry) {
fileEntry.file(function(file) {
var reader = new FileReader();
reader.onloadend = function(evt) {
var _machines = JSON.parse(evt.target.result);
machinesCache.setMachines(_machines.AllMainCategories);
};
reader.readAsText(file);
}, errorHandler);
};
window.resolveLocalFileSystemURL("cdvfile://localhost/persistent/machinedata/machines.json", onResolveSuccess, errorHandler);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13504 次 |
| 最近记录: |