We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9528ced commit 7c5c4d2Copy full SHA for 7c5c4d2
1 file changed
Classes/JSBScriptingSupport.m
@@ -151,11 +151,9 @@ + (id)require:(NSString *)name
151
script = [NSString stringWithContentsOfFile:[name stringByAppendingPathExtension:@"js"] encoding:NSUTF8StringEncoding error:nil];
152
}
153
if (script) {
154
- NSString *closure = [NSString stringWithFormat:
155
- @"(function() {\n"
156
- @" %@\n"
157
- @"})();\n", script];
158
- [globalContext evaluateScript:closure];
+ JSValue *function = globalContext[@"Function"];
+ JSValue *value = [function constructWithArguments:@[script]];
+ [value callWithArguments:nil];
159
module = globalContext[@"JSB"][@"exports"];
160
161
0 commit comments