Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2350

Add async calls to normal JavaScript

    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      Currently async call are only available with -gen js if you unwire the client send/recv methods (pretty messy and unintuitive) or if you use jQuery (-gen js:jquery). This patch makes it easy to use async callbacks with any Thrift call by simply appending the desired callback to the args). e.g.

      client.myFunc(arg1, arg2, function (result) {
      //do callback stuff with result
      //result will be the normal return value or the exception
      });

      This patch preserves the existing sync call style (just leave off the callback).

      Compiler js generator changes
      =============================

      • Combining node and jquery switches now results in a compile error rather than silently producing corrupt code in ./gen-nodejs
      • Updated comments
      • Added ability to make async calls without jQuery

      Node test client.js
      ===================

      • Corrected comments and spelling

      JS thrift.js
      ====================

      • Added support for async calls w/o jQuery

      Node/JS test.js
      ====================

      • Updated comments to clarify jQuery dependency (-gen js:jquery)

      Node/JS test-nojq.js test-nojq.html
      ===================================

      • Full test suite for normal JS build (-gen js)

      Node http test server and handler
      =================================
      linted

      Attachments

        Activity

          People

            henrique Henrique Mendonca
            codesf Randy Abernethy
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: