diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-08-19 20:24:29 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-08-19 20:24:29 +0200 |
commit | 5fa70b1eb39d4fa309ee7109074513ea685a33b6 (patch) | |
tree | 77ba75510a32800217034e1646d836272dbd16c1 /src/headless | |
parent | 08b490783bcf2844709b4cb69a093fb8bb679bd3 (diff) |
android helpers
Diffstat (limited to 'src/headless')
-rw-r--r-- | src/headless/helpers.ts | 20 |
1 files changed, 13 insertions, 7 deletions
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<Wallet> { - const myNotifier = new ConsoleNotifier(); + const myNotifier: Notifier = { + notify() { + if (args.notifyHandler) { + args.notifyHandler(""); + } + } + } const myBadge = new ConsoleBadge(); |