Skip to content

Commit bc0353d

Browse files
committed
quickjs callback improvements
1 parent 0af390d commit bc0353d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Runtime/Helpers/Callback.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,19 @@ public object Call(params object[] args)
118118
}
119119
#endif
120120
#if REACT_QUICKJS
121+
else if (callback is QuickJS.ScriptFunction sf)
122+
{
123+
return sf.Invoke<object>(args);
124+
}
125+
else if (callback is QuickJS.ScriptValue sv)
126+
{
127+
return new QuickJS.ScriptFunction(QuickJS.ScriptEngine.GetContext(sv.ctx), sv).Invoke<object>(args);
128+
}
121129
else if (callback is QuickJS.Native.JSValue qf)
122130
{
123131
var eg = (context?.Script.Engine as Scripting.QuickJSEngine);
124132
if (eg == null) return null;
125-
return new QuickJS.ScriptFunction(eg.MainContext, qf, eg.Global).Invoke<object>(args);
133+
return new QuickJS.ScriptFunction(eg.MainContext, qf).Invoke<object>(args);
126134
}
127135
#endif
128136
else

Runtime/ReactUnity.asmdef

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
"GUID:478a2357cc57436488a56e564b08d223",
99
"GUID:9a66a2efedc711946b7428ea9b41cc0d",
1010
"GUID:118b4ca3a1852354bac065cf952c1e85",
11-
"GUID:ac4126d60783f3d4a98aee6be9a997aa",
12-
"GUID:eda0539582471264796e5affb41fe082",
13-
"GUID:2746379d15af6e84cbeb433df77dd384"
11+
"GUID:ac4126d60783f3d4a98aee6be9a997aa"
1412
],
1513
"includePlatforms": [],
1614
"excludePlatforms": [],

0 commit comments

Comments
 (0)