From b05ae451339df7040be81da6808b2523a61c59cd Mon Sep 17 00:00:00 2001 From: Frank Wuerthwein Date: Sun, 3 May 2009 15:30:06 +0000 Subject: Add argument to callback --- src/lib/binaryXHR.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/binaryXHR.js b/src/lib/binaryXHR.js index dd0f91b..d91ad72 100644 --- a/src/lib/binaryXHR.js +++ b/src/lib/binaryXHR.js @@ -202,9 +202,10 @@ function FetchBinaryURL(url) { // =============================================================== // Asyncronously load a binary file from the specified URL // -// callback must be a function with a single argument: -// bf = an object of type BinaryFile -function FetchBinaryURLAsync(url, callback) { +// callback must be a function with one or two arguments: +// - bf = an object of type BinaryFile +// - optional argument object (used only if callback_arg not undefined) +function FetchBinaryURLAsync(url, callback, callback_arg) { var callback_wrapper = function() { if(this.readyState == 4) { var response=this.responseBody; @@ -212,7 +213,11 @@ function FetchBinaryURLAsync(url, callback) { response=this.responseText; } var bf=new BinaryFile(response); - callback(bf); + if (callback_arg!=null) { + callback(bf,callback_arg); + } else { + callback(bf); + } } } -- cgit v1.1-4-g5e80