- Home /
Question by
Toxic Blob · Jul 17, 2011 at 06:48 PM ·
c#javascriptdelegateuitoolkit
Accessing C# Delegate from Javascript
What is the JavaScript equivalent of the C#... playButton.onTouchUpInside += sender => Debug.Log( "button touched" );
?
I’m trying to use @prime_31’s UIToolkit, but all the examples that use it use it with C# - which I don’t know and don’t currently have time to learn.
Comment
Best Answer
Answer by Peter G · Jul 17, 2011 at 07:08 PM
You cannot declare delegates in js, but you can use function types to add methods to delegates created in a C# class.
someDelegate += MyMethod;
someDelegate += function() {
Debug.Log("Anonymous Method");
};
function MyMethod() {
}