- Home /
Having a problem translating part of a script which uses C# delegates into JS
I'm following this tutorial series on procedural terrain generation. For the tutorial, it uses C#, but I'm translating it to JS since that's the coding language I am most fluent with.
I've gotten through a lot of the tutorial series, but now I'm having a problem translating this specific part of the script: (you can tell I already partially translated it)
public function RequestMapData(callback:Action.<MapData>) {
var threadStart:ThreadStart = delegate {
MapDataThread(callback);
};
}
The part I can't get translated is "var threadStart:ThreadStart = delegate { ... };". I read up on this and apparently you can't use delegates in JS, so I have no idea what to do here. Is there some JS equivalent of delegates?
Any help translating this chunk of code would really be appreciated, thanks so much.
Your answer
Follow this Question
Related Questions
Sending the C# function parameter to JS function. 1 Answer
Multiple Cars not working 1 Answer
Lower player's health from separate script. 2 Answers
Convert this string formatting from C# to JS 1 Answer
Convert c# to Js? 1 Answer