等待 onload 事件完成的方法
function(){
var filedata=null;
reader.onload=function(e){
filedata=e.target.result;
};
reader.readAsBinaryString(file);
//I need code to wait till onload event handler gets completed.
return filedata;
}
reader.onload = process
并将process
函数更改为process(e)
,然后从内部处理事件(也许使用var filedata = e.target.result
)。 - syockit