From JSContext.h:
// This method may be called from within an Objective-C block or method invoked
// as a callback from JavaScript to retrieve the callback's arguments, objects
// in the returned array are instances of JSValue. Outside of a callback from
// JavaScript this method will return nil.
+ (NSArray *)currentArguments;
Leading to the following:
ctx[@"func"] = ^{
NSArray *args = [JSContext currentArguments];
for (JSValue *arg in args) {
NSLog( @"%@", arg);
}
};
[ctx evaluateScript:@"func('arg1', 'arg2');"];