I have the following call which runs a method within a cacheListener object asynchronously:
ohttp.asyncOpenCacheEntry(url, 4, cacheListener);
Here is what the callback object/function looks like:
var cacheListener = {
onCacheEntryAvailable: function(arg1, arg2, arg3) {
// do something.
}
}
What I’m trying to do is add an extra argument to that callback. I’ve tried appending a third argument at the end of the call and then in the function definition, but it won’t get passed properly like this (myArg at the end):
ohttp.asyncOpenCacheEntry(url, 4, cacheListener, myArg);
Here is what the callback object/function looks like with the extra argument:
var cacheListener = {
onCacheEntryAvailable: function(arg1, arg2, arg3, myArg) {
// do something.
}
}
myArg, as expectable, isn’t passed, and I’m not sure how to make a construct that would allow for the argument to be passed properly.
Thanks for your help,
You’re going to have to wrap it up if you don’t control the code that’s using your callback. Something like this:
If there are other methods in the callback objects then you’ll have to wrap those too.