-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Description
Hello, i'm trying to use ClearScript with my internal class and everything is working fine, but i can't use a public delegate inside this class because i'm getting an error message with something like: "Error: Access to "Microsoft.ClearScript.EventSource<PROJECT.ScriptContext.EmptyEvent>.connect(object)" is not possible due to the protection level.".
I'm not getting an exception using System.EventHandler instead of a custom delegate
C# code:
...
V8ScriptEngine engine = new V8ScriptEngine();
engine.AddHostObject("API", HostItemFlags.PrivateAccess, new ScriptContext());
...
internal class ScriptContext
{
public delegate void EmptyEvent();
public event EmptyEvent OnTest;
internal void OnTestInvoke()
{
OnTest?.Invoke();
}
}
Javascript code:
API.OnTest.connect(function() {
});
Maybe i'm doing something wrong but i can't find a solution for it.
Thanks!