From 7a59183bb111efad732cad790ad9468e8423682a Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 12 Apr 2017 16:02:42 +0200 Subject: [PATCH] pinpad.create should always be async --- www/common/pinpad.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/www/common/pinpad.js b/www/common/pinpad.js index 78ae607db..aa2cc532f 100644 --- a/www/common/pinpad.js +++ b/www/common/pinpad.js @@ -5,13 +5,28 @@ define([ var Nacl = window.nacl; var create = function (network, proxy, cb) { - if (!network) { return void cb('INVALID_NETWORK'); } - if (!proxy) { return void cb('INVALID_PROXY'); } + if (!network) { + window.setTimeout(function () { + cb('INVALID_NETWORK'); + }); + return; + } + if (!proxy) { + window.setTimeout(function () { + cb('INVALID_PROXY'); + }); + return; + } var edPrivate = proxy.edPrivate; var edPublic = proxy.edPublic; - if (!(edPrivate && edPublic)) { return void cb('INVALID_KEYS'); } + if (!(edPrivate && edPublic)) { + window.setTimeout(function () { + cb('INVALID_KEYS'); + }); + return; + } Rpc.create(network, edPrivate, edPublic, function (e, rpc) { if (e) { return void cb(e); }