Error calling method on NPObject in FileReader in cordova app (Intel xdk android build) -
i trying follow this instructions able read files.
as result have access file system reading file produce error:
uncaught error: error calling method on npobject
fun part if try call readastext(file)
function second time file reader reads file still produce same error.
how avoid error , how make filereader work in first call?
!doctype html> <html> <head> <title>filereader example</title> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8"> // wait device api libraries load // document.addeventlistener("deviceready", ondeviceready, false); // device apis available // function ondeviceready() { window.requestfilesystem(localfilesystem.persistent, 0, gotfs, fail); } function gotfs(filesystem) { filesystem.root.getfile("readme.txt", null, gotfileentry, fail); } function gotfileentry(fileentry) { fileentry.file(gotfile, fail); } function gotfile(file){ readastext(file); readastext(file); } function readastext(file) { var reader = new filereader(); reader.onloadend = function(evt) { console.log("read text"); console.log(evt.target.result); }; reader.readastext(file); } function fail(evt) { console.log(evt.target.error.code); } </script> </head> <body> <h1>example</h1> <p>read file</p> </body> </html>
this error occurs when try, using method called javascript interface, interact ui.
check here
Comments
Post a Comment