1.引入#import <JavaScriptCore/JavaScriptCore.h>
2.JSContext *jsContext = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
3.jsContext[@"test"] = ^() {
NSArray *argumentsArr = [JSContext currentArguments];
for (value *jsVal in argumentsArr) {
NSLog(@"%@", value);
}
JSValue *this = [JSContext currentThis];
NSLog(@"this: %@",this);
};
4.html <button onclick="test()"></button>