From 2716decfde9382a867ed71fb78b06d5b22d1c58a Mon Sep 17 00:00:00 2001 From: Julia Friesel Date: Tue, 11 Sep 2018 08:41:54 +0200 Subject: [PATCH] Add comment about node process stdout --- nodejs-assets/nodejs-project/main.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/nodejs-assets/nodejs-project/main.js b/nodejs-assets/nodejs-project/main.js index 77ab09d..1dc6cf8 100644 --- a/nodejs-assets/nodejs-project/main.js +++ b/nodejs-assets/nodejs-project/main.js @@ -1,17 +1,15 @@ +// too see stdout / stderr from this process, run +// adb logcat | grep "NODEJS-MOBILE" const rnBridge = require('rn-bridge') -try { - const bcryptjs = require('bcryptjs') +const bcryptjs = require('bcryptjs') - rnBridge.channel.on('message', (msg) => { - msg = JSON.parse(msg) - if (msg.type === 'request-hash') { - const hash = bcryptjs.hashSync(msg.message, 10) - rnBridge.channel.send(JSON.stringify({ - type: 'hash', - message: hash - })) - } - }) -} catch (err) { - rnBridge.channel.send(JSON.stringify(err.message)) -} \ No newline at end of file +rnBridge.channel.on('message', (msg) => { + msg = JSON.parse(msg) + if (msg.type === 'request-hash') { + const hash = bcryptjs.hashSync(msg.message, 10) + rnBridge.channel.send(JSON.stringify({ + type: 'hash', + message: hash + })) + } +}) \ No newline at end of file