[Groonga-commit] groonga/express-kotoumi [master] Specify callback for emitMessage() as a object key of the options

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Jan 29 15:21:21 JST 2013


YUKI Hiroshi	2013-01-29 15:21:21 +0900 (Tue, 29 Jan 2013)

  New Revision: 945a84dd32719e3cceecb397e82d2eb6bf5b3024
  https://github.com/groonga/express-kotoumi/commit/945a84dd32719e3cceecb397e82d2eb6bf5b3024

  Log:
    Specify callback for emitMessage() as a object key of the options

  Modified files:
    lib/frontend/rest-handler.js

  Modified: lib/frontend/rest-handler.js (+14 -11)
===================================================================
--- lib/frontend/rest-handler.js    2013-01-29 15:19:59 +0900 (495cfac)
+++ lib/frontend/rest-handler.js    2013-01-29 15:21:21 +0900 (9d59504)
@@ -9,17 +9,20 @@ function createHandler(type,
   return (function(request, response) {
     var message = requestBuilder(request);
     var timeout = message.timeout || null;
-    connection.emitMessage(type, message, function(error, responseMessage) {
-      if (error) {
-        var body = responseMessage && responseMessage.body || null;
-        response.contentType('application/json');
-        response.send(body, error);
-      } else {
-        var body = responseMessage.body;
-        response.contentType('application/json');
-        response.send(body, 200);
-      }
-    }, timeout);
+    connection.emitMessage(type, message, {
+      callback: function(error, responseMessage) {
+        if (error) {
+          var body = responseMessage && responseMessage.body || null;
+          response.contentType('application/json');
+          response.send(body, error);
+        } else {
+          var body = responseMessage.body;
+          response.contentType('application/json');
+          response.send(body, 200);
+        }
+      },
+      timeout: timeout
+    });
   });
 }
 exports.createHandler = createHandler;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index