Class OneJSGlobals
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
Exposes a runtime-created C# object to JavaScript as a global on the live OneJS runner.
The runner's own globals are an inspector-assigned list on OneJS.JSRunner (_globals), which cannot serve objects that only come into existence while the game is running. This helper does exactly what JSRunner's own InjectGlobals does for its inspector entries: hand the object to QuickJS to get a handle, then wrap that handle on the JS side so scripts can use the object directly (call methods, read properties, subscribe to events with add_OnXChanged).
public static class OneJSGlobals
- Inheritance
-
objectOneJSGlobals
Methods
- Set(string, object)
Sets
globalThis[key]. Returns false (and logs nothing) when there is no live runner yet - which is normal before the app has mounted, so callers should treat a false return with the same tolerance the old API's null check had.