Theia json-rpc

I want to understand how the front and back ends of Theia communicate with JSON RPC, but I don’t quite understand some code.
In class JsonRpcProxyFactory, i find the Construction method
constructor(public target?: any) {
this.waitForConnection();
}
There is no code to store this parameter, such as “this. Target = target”.
And I did find that something was passed in as a parameter, like this
new JsonRpcProxyFactory(arg)
I want to know how does it work

Hi @helloworld, thank you for your question.

Regarding the target property: Notice the public keyword in front of it. This is basically a shortcut for assigning a public property with the constructor argument. See this blog post for more info on that. We use this shortcut quite often throughout the Theia codebase, in order to decrease the amount of boilerplate code that we have to use. See this constructor for another example.

1 Like

Thank you for your answer. I got it