Skip to content

Instantly share code, notes, and snippets.

@joelklabo
Created December 1, 2010 20:55
Show Gist options
  • Save joelklabo/724203 to your computer and use it in GitHub Desktop.
Save joelklabo/724203 to your computer and use it in GitHub Desktop.
actionscript example
var genExtFunc:Function = function (func:Function):Function {
return function (...args):* { /// <----- this is the "...args" i am curious about
try {
for (var arg:* in args){
// Terrible hack working around half baked
// ExternalInterface support provided by
// Safari on Windows
// takes json strings and turns them into objects
if (args[arg] is String){
var o : Object = JSON.decode(args[arg]);
args[arg] = o;
}
}
return func.apply(null, args);
}
catch (e:Error) {
if (e.errorID == 1009){
e.message = "There was a problem with your parameters, " + JSON.encode(args);
}
return e;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment