You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Elswick, Richard" <el...@us.panasonic.com> on 2012/08/29 21:32:39 UTC

javascript generated services and code for client.

Hi all,

I am trying to understand some of the design decisions to the generated Javascript code. Note, I am only investigating the client javascript side.

In the tutorial.thrift file, the following is the defined service:

service Calculator extends shared.SharedService {

   i32 add(1:i32 num1, 2:i32 num2),

   i32 calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch),
}

The code generated for Javascript looks (minus a few items) like this:

        CalculatorClient = function(input, output) {}

I really expected this:

        Calculator = function(input, output) {}

This would also match the filename, which is Calculator.js

Is this something that makes sense changing?

I am sure there is more questions I have, but still a bit more.  Would it be reasonable for me to add some comments to the t_js_generator.cc file, which adds comments to the generated .js file?  I can probably do some of this and submit the patch.  This will help new users in getting up to speed with thrift on the javascript side.

One additional item I cannot yet seem to grasp my head around is all the read(input) and write(output) functions on the various javascript objects created.  It just isn't clear to me what these do or are for.

Thanks,

Richard Elswick
HMI Senior System Engineer
elswickr@us.panasonic.com
Ph. 248-324-6454
Panasonic Automotive Systems Company of America
37101 Corporate Drive
Farmington Hills, MI 48331