I need to return a variable from a function with anonymous functions inside of it.
Like this:
function resize(f) {
...
reader.onloadend = function() {
...
image.onload = function() {
...
finalFile = dataURItoBlob(canvas.toDataURL(fileType));
}
}
}
I need to return the variable finalFile to another variable that called this function, but it keeps returning null, even if I set Global variable it doesn't work. Any idea?