[英]Cordova file plugin doesn't work
I'm using cordova 5.1.1
in my project. 我在我的项目中使用
cordova 5.1.1
。 I have in the cordova_plugins.js
the declaration of the file plugin: 我在
cordova_plugins.js
中有文件插件的声明:
{
"file": "plugins/cordova-plugin-file/www/FileSystem.js",
"id": "cordova-plugin-file.FileSystem",
"clobbers": [
"window.FileSystem"
]
},
But when I try to use the plugin like this: 但是当我尝试使用这样的插件时:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
onFileSystemSuccess, fail);
I get: 我得到:
Uncaught ReferenceError: LocalFileSystem is not defined
No response listener so the file plugin isn't loaded that's why you get 没有响应侦听器,因此未加载文件插件,这就是为什么
Uncaught ReferenceError: LocalFileSystem is not defined
Add this and include your request inside it: 添加它,并在其中包含您的请求:
document.addEventListener("deviceready", function() {
//use request file here
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
onFileSystemSuccess, fail);
}, false);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.