From fdcdae0412a696fe7a1d1aab14e10b0f68147c02 Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Wed, 4 Sep 2019 14:07:18 +0200 Subject: [PATCH] Use promises in content scripts --- scripts/gather.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/gather.ts b/scripts/gather.ts index d162efe..fa074dc 100644 --- a/scripts/gather.ts +++ b/scripts/gather.ts @@ -295,7 +295,7 @@ class Gatherer { function gather(msg: any, sender: any, callback: Function) { try { if (!msg || msg.type !== "DTA:gather" || !callback) { - return; + return Promise.resolve(null); } const gatherer = new Gatherer(msg); const result = { @@ -313,10 +313,11 @@ function gather(msg: any, sender: any, callback: Function) { ), }; urlToUsable(result, result.baseURL); - callback(result); + return Promise.resolve(result); } catch (ex) { console.error(ex.toString(), ex.stack, ex); + return Promise.resolve(null); } }