Is possible to use as event handling? #1057
Answered
by
ghost
nathan130200
asked this question in
Q&A
-
I'm creating a game server, i can use Jint as external event handling? Example: Console.CancelKeyPress event, ask for a Javascript jint scripts and these scripts can modify the values, like: function OnCancelKeyPress(e){
e.Cancel = true;
console.log('i cancelled this event :P');
} I don't have ideias how to implement or if this is possible in Jint Engine... (Dynamic Script Executing) |
Beta Was this translation helpful? Give feedback.
Answered by
ghost
Feb 20, 2022
Replies: 1 comment
-
yes. Jint convert C# event to add_NameEvent for subscribe and remove_NameEvent for unsubscribe public class Test()
{
public event Action SomeEvent;
} in js function Handler(){
Log("Some happend")
}
var testClass = new Test()
testClass.add_SomeEvent(Handler)
testClass.remove_SomeEvent(Handler) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
nathan130200
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yes. Jint convert C# event to add_NameEvent for subscribe and remove_NameEvent for unsubscribe
example:
C#
in js