diff options
author | Florian Dold <florian.dold@gmail.com> | 2015-12-17 22:56:24 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2015-12-17 22:56:24 +0100 |
commit | 38c947d7712d77070ca521b4718032fb31c0f108 (patch) | |
tree | f460392f7f20fdf7ae01e1d3f57b524edd52932f /extension/lib | |
parent | 5f907c13fc76189ace1537af43903e7cd2c82c84 (diff) | |
download | wallet-core-38c947d7712d77070ca521b4718032fb31c0f108.tar.xz |
Towards payment.
Diffstat (limited to 'extension/lib')
-rw-r--r-- | extension/lib/util.js | 4 | ||||
-rw-r--r-- | extension/lib/util.ts | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/extension/lib/util.js b/extension/lib/util.js index 801d7d189..71bfce4d3 100644 --- a/extension/lib/util.js +++ b/extension/lib/util.js @@ -28,3 +28,7 @@ function format(s, ...args) { s = s.replace(/{([0-9]+)}/g, r); return s; } +function promiseFinally(p, fn) { + return p.then((x) => { fn(); return x; }) + .catch((e) => { fn(); throw e; }); +} diff --git a/extension/lib/util.ts b/extension/lib/util.ts index 106e22970..b30d60432 100644 --- a/extension/lib/util.ts +++ b/extension/lib/util.ts @@ -32,3 +32,8 @@ function format(s: string, ...args: any[]) { return s; } + +function promiseFinally<T>(p: Promise<T>, fn): Promise<T> { + return p.then((x) => { fn(); return x; }) + .catch((e) => {fn(); throw e;}); +}
\ No newline at end of file |