From 58d7ba12374b97515c5b84c52146d0afa5d9a5e6 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Sun, 12 Sep 2021 17:51:02 -0400 Subject: [PATCH] Restore then() functionality --- utils/GunSmith/GunSmith.js | 7 +++++++ utils/GunSmith/GunT.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/utils/GunSmith/GunSmith.js b/utils/GunSmith/GunSmith.js index 6f85494d..38ec68e8 100644 --- a/utils/GunSmith/GunSmith.js +++ b/utils/GunSmith/GunSmith.js @@ -400,6 +400,13 @@ function createReplica(path, afterMap = false) { ) } } + }, + then() { + return new Promise(res => { + this.once(data => { + res(data) + }) + }) } } } diff --git a/utils/GunSmith/GunT.ts b/utils/GunSmith/GunT.ts index c1c04f1e..d62ea531 100644 --- a/utils/GunSmith/GunT.ts +++ b/utils/GunSmith/GunT.ts @@ -70,6 +70,7 @@ namespace GunT { user(pub: string): GUNNode put(data: ValidDataValue, cb?: Callback): GUNNode set(data: ValidDataValue, cb?: Callback): GUNNode + then(): Promise } export interface CreateAck {