Accessing OnSceneGUI with EditorWindow in JS

I have been trying now to access OnSceneGUI() while using EditorWindow and nothing seems to be working. Everything I have looked at is in C# and converting it to JS just yields errors. I have tried SceneView.onSceneGUIDelegate += OnSceneGUI(); but it just give me the following error: Operator ‘+’ cannot be used with left hand side of type ‘function(UnityEditor.SceneView): void’ and right hand side of type ‘void’.

At this point I am willing to try anything. I really need it to be in JS. If I really need to I will convert to C#, but that is a last resort. Thanks in advance!

Try with this SceneView.onSceneGUIDelegate += OnSceneGUI; (no parenthesis).

Actually you need to set the callback. If you use parenthesis you call the function, so you try to assign the function result.