From 544604a2bc6e7edc8ede3bc819eca10cc56538b8 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 1 Mar 2017 04:26:10 +0300 Subject: [PATCH] added promise result support... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/peer.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/ui (gen4)/features/peer.js b/ui (gen4)/features/peer.js index d68ff85b..3c3d9838 100755 --- a/ui (gen4)/features/peer.js +++ b/ui (gen4)/features/peer.js @@ -409,11 +409,30 @@ module.ChildProcessPeer = core.ImageGridFeatures.Feature({ // return the value... if(!msg.ignore_return){ - process.send({ - type: 'action-call-result', - id: msg.id, - value: res === that ? null : res, - }) + res.then ? + // promise result... + res + .then(function(res){ + process.send({ + type: 'action-call-result', + id: msg.id, + value: res, + }) + }) + .catch(function(err){ + process.send({ + type: 'action-call-result', + id: msg.id, + error: err, + }) + }) + // normal result... + : process + .send({ + type: 'action-call-result', + id: msg.id, + value: res === that ? null : res, + }) } // error...