遇到一些特殊问题,将不胜感激
// image Editor
function AddPic() {
var ret=loadpic();
console.log("retval=" + ret);
}
第二文件导入到第一文件
var retval;
function loadpic() {
//loads pictures in canvas frames and allow user to edit
return function doneOK() {
return retval;
};
}
function edit1() { retval=1;}
function edit2() { retval=2;}
function edit3() { retval=3;}
function edit4() { retval=4;}
function edit5() { retval=5;}
function edit6() { retval=6;}
//Depending on the user action different functions are called
//user can take any amount of time before clicking "OK"
function onlclickOK() {doneOK();}
问题:当用户单击“确定”按钮时我们需要调用doneok()函数进而将retval值返回到调用页面
这是我被感动的地方;
//Still there are some better ways to do. In case, this may help a little bit in calling the function to get the retval.
function loadpic() {
//loads pictures in canvas frames and allow user to edit
return doneOK()
}
function doneOK() {
return retval;
};