From 5fa70b1eb39d4fa309ee7109074513ea685a33b6 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 19 Aug 2019 20:24:29 +0200 Subject: android helpers --- src/headless/helpers.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/headless/helpers.ts') diff --git a/src/headless/helpers.ts b/src/headless/helpers.ts index 975c45e52..5636b3921 100644 --- a/src/headless/helpers.ts +++ b/src/headless/helpers.ts @@ -36,12 +36,6 @@ import fs = require("fs"); const enableTracing = false; -class ConsoleNotifier implements Notifier { - notify(): void { - // nothing to do. - } -} - class ConsoleBadge implements Badge { startBusy(): void { enableTracing && console.log("NOTIFICATION: busy"); @@ -120,6 +114,12 @@ interface DefaultNodeWalletArgs { * the wallet database is stored only in memory. */ persistentStoragePath?: string; + + + /** + * Handler for asynchronous notifications from the wallet. + */ + notifyHandler?: (reason: string) => void; } /** @@ -128,7 +128,13 @@ interface DefaultNodeWalletArgs { export async function getDefaultNodeWallet( args: DefaultNodeWalletArgs = {}, ): Promise { - const myNotifier = new ConsoleNotifier(); + const myNotifier: Notifier = { + notify() { + if (args.notifyHandler) { + args.notifyHandler(""); + } + } + } const myBadge = new ConsoleBadge(); -- cgit v1.2.3