I have an upload handler connected to my js script.
(This upload handler is written in c++ and thus I'm unable to pass js objects around)
this upload handler starts the upload and immediately returns an UID (based on the current timestamp in milliseconds. looks like this :
var transferUid = fileTransfers.addFileTransfer(sourcePath,destination);
I'd like to add a callback function to this. When the transfer is finished. This js function is automatically executed when finished :
filetransfersfinished(uid){...}
is it reasonable to do something like this :
var finishFunctions = [];
finishfunctions [transferUid] = function(){/*callbacks*/}
transferUid could be like 184548178452 ...
and call it when the automatic function is called :
filetransfersfinished(uid){ finishfunctions[uid](); }
Or is there a better solution you can think of?