2011-09-06 42 views
0

我正在使用来自文档的示例代码,并且只有第一个写实例正在执行。该功能只是在没有错误之后结束。Phonegap - Filewriter只写第一行

生成的文件包含文本:“一些示例文本”

任何想法?

function gotFileWriter(writer) { 
    writer.onwrite = function(evt) { 
     console.log("write success"); 
    }; 
    writer.write("some sample text"); 
    // contents of file now 'some sample text' 
    writer.truncate(11); 
    // contents of file now 'some sample' 
    writer.seek(4); 
    // contents of file still 'some sample' but file pointer is after the 'e' in 'some' 
    writer.write(" different text"); 
    // contents of file now 'some different text' 
} 

回答